java - Write result image using jmagick -
i want crop part of image , write result image file. code looks this
imageinfo imageinfo = new imageinfo("file path"); magickimage image = new magickimage(imageinfo ); rectangle cropinfo = new rectangle(); cropinfo.x = 20; cropinfo.y = 20; cropinfo.width = 300; cropinfo.height = 300; magickimage result = image.cropimage(cropinfo); result.setfilename("path result file"); boolean s = result.writeimage(imageinfo);
the above code works why writeimage using old imageinfo? , magickimage.setfilename don't make sense me. think should create new imageinfo object , write imageinfo. following code make more sense don't work expected.
magickimage result = image.cropimage(cropinfo); imageinfo resulinfo = new imageinfo("path new file"); boolean s = result.writeimage(imageinfo);
does experience ?
it inconvenient me keep original imageinfo around, tried , worked:
result.setfilename("path result file"); boolean s = result.writeimage(new imageinfo());
as why parameter needed @ all, mystery remains. null not work.
Comments
Post a Comment