Page 1 of 1

CommandException during cropping

Posted: 2013-10-26T11:12:20-07:00
by appu
I am using ImageMagick-6.8.6-Q16 in Windows 7 platform for my application. I need to crop the input image to the specified size and process it. So writes the cropped image to the system temp folder (%Temp%). But intermittently IM failed to save the cropped images to the filesystem. Out of 20 runs, it happens 2 or 3 times. Following are the exception logs.

Used Im4Java-1.4.0v to interface my java application to underlying IM library.

Code: Select all

Caused by: org.im4java.core.CommandException: org.im4java.core.CommandException: convert.exe: WriteBlob Failed `-' @ error/png.c/MagickPNGErrorHandler/1804.
        at org.im4java.core.ImageCommand.run(ImageCommand.java:219)
        at com.my.IMagick.cropImage(MagickComparison.java:209)
        ... 11 more
Caused by: org.im4java.core.CommandException: convert.exe: WriteBlob Failed `-' @ error/png.c/MagickPNGErrorHandler/1804.
        at org.im4java.core.ImageCommand.finished(ImageCommand.java:253)
        at org.im4java.process.ProcessStarter.run(ProcessStarter.java:314)
        at org.im4java.core.ImageCommand.run(ImageCommand.java:215)
        ... 12 more
Images are saved in the PNG format. In Im4Java, IMOperation placeholders are defined as below

Code: Select all

IMOperation operation = new IMOperation();
operation.addImage();                                ---> for buffered input image
operation.crop(width, height, startX, startY);
operation.addImage("png:-");                      ---> output image place holder
Please help me to resolve this issue.

Re: CommandException during cropping

Posted: 2013-10-26T11:14:41-07:00
by fmw42
It is possible that your tmp directory is periodically getting filled and so IM cannot write to the tmp directory. Make sure you tmp directory is large enough and purged regularly