CommandException during cropping

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
appu
Posts: 29
Joined: 2013-09-20T10:10:02-07:00
Authentication code: 6789

CommandException during cropping

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: CommandException during cropping

Post 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
Post Reply