Resize command returns error code 141

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
andanthor
Posts: 3
Joined: 2011-10-12T12:12:20-07:00
Authentication code: 8675308

Resize command returns error code 141

Post by andanthor »

I am getting an error code 141 while attempting to resize certain images, which is very confusing since according to IMs documentation (http://www.imagemagick.org/script/exception.php) error codes range from 300 to 800.

Does anyone have any information on Error Code 141 that can help me solve this blocking issue?

Some context:
  • ImageMagick was installed on an Amazon S3 instance via yum install ImageMagick
    ImageMagick is being invoked by my Scala code through the im4Java library (who claims the error codes are returned as-is from IM)
    The problematic images are also being cropped. I have tried cropping and resizing in one command, and cropping THEN resizing, with the same result (the resize fails, not the crop)
Thanks in advance,

Alejandro.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resize command returns error code 141

Post by fmw42 »

what is your exact command(s)

what version of IM are you using on what platform?
andanthor
Posts: 3
Joined: 2011-10-12T12:12:20-07:00
Authentication code: 8675308

Re: Resize command returns error code 141

Post by andanthor »

Hi, thanks for replying.

I'm using ImageMagick 6.5.4-7 on an Amazon S3 instance running Linux. ImageMagick was installed using YUM.

Code: Select all

>convert -version
Version: ImageMagick 6.5.4-7 2011-01-17 Q16 OpenMP http://www.imagemagick.org
I have tried different options according to the documentation, but in particular the following two fail with exactly the same error:

Code: Select all

convert -extract "1382x1382+173+0" -resize "75x75>" "${1}" -quality "75.0" - 
convert -crop "1382x1382+173+0" -resize "75x75>" "${1}" -quality "75.0" - 
Where "${1}" is the placeholder im4java uses for the input image.

I should mention that issuing a resize without the crop or extract options works with no problem. I only get the error code 141 when doing a crop or extract.

To add to my confusion, the problem seems to be intermitent. I have tried converting 30 images, and I get an error on file #20, only to retry the same set and get the process to fail on file #25 or #15. This leads me to rule out a problem with the source images.

Any ideas? In particular, Im interested in the meaning of error code 141, which is not documented on Image Magick's website.

Thanks again for any help you can offer,

Alejandro.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resize command returns error code 141

Post by fmw42 »

try proper IM 6 syntax with the input image first

convert "${1}"[1382x1382+173+0] -resize "75x75>" -quality "75.0" -
(no space between input image and subsection)

convert "${1}" -crop "1382x1382+173+0" +repage -resize "75x75>" -quality "75.0" -

(-extract can be used before or after the input image)

Otherwise, try in command line mode with a unique output image (rather than stdout) to see if it is a problem with your java. If it does not work in command line mode, then perhaps upgrade IM. Your version is rather old.

Post a link to one of your failing images, so others can test.

see http://www.imagemagick.org/Usage/basics/#why and http://www.imagemagick.org/script/comma ... essing.php


I don't know anything about IM error codes, but suspect it is coming from somewhere else.
andanthor
Posts: 3
Joined: 2011-10-12T12:12:20-07:00
Authentication code: 8675308

Re: Resize command returns error code 141

Post by andanthor »

Hi all, thank you for responding.

It seems the problem is somewhere in the im4java wrapper, specifically when capturing the output of the JNI call to ImageMagick.

The only solution that worked was saving the result in a temporary file and then loading it into a BufferedImage, instead of using im4java's ability to return a BufferedImage directly.

If you are curious about the details, I can provide some sample source code.

Cheers.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Resize command returns error code 141

Post by anthony »

Also try adding a -regard-warnings operational setting.
http://www.imagemagick.org/Usage/basics ... d-warnings
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ekang
Posts: 1
Joined: 2013-02-15T13:04:43-07:00
Authentication code: 6789

Re: Resize command returns error code 141

Post by ekang »

Hi,
I got the same error, and I agree with you that it seems to be im4java wrapper issue.
Can you please post your solution to work around it?

Thanks!
Post Reply