After image resize new images are partially greyed out

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
Joshva
Posts: 7
Joined: 2016-03-31T19:58:32-07:00
Authentication code: 1151

After image resize new images are partially greyed out

Post by Joshva » 2017-06-18T19:01:07-07:00

Hi,

I call ImageMagick from a Java Application server. Occasionally (about 1 in 100 times) an image does not resize correctly and the bottom half of it becomes grey (although not the grey i was setting for the background)

It looks like processing didn't complete

I am using Convert with the following parameters

resize 927>
background #ffffff
gravity center
extent 927
quality 90
crop 927x0
synchronize

No error is returned. If i re run it though, it works correctly. It seems random as to which images it happens to

Any help is greatly appreciated

Below is an example:
Image

and here is the original:
Image

User avatar
fmw42
Posts: 21839
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: After image resize new images are partially greyed out

Post by fmw42 » 2017-06-18T19:25:19-07:00

Does your processing always fail on this image? If not, then this behavior can occur if you are running out of temp space. Check your /tmp directory or the directory you have set for MAGICK_TEMPORARY_PATH.

What is your IM version and platform? Perhaps you need to upgrade your version of IM. If it happens only for JPG images, then check and upgrade libjpeg.

Your command is not correct. You cannot do -crop 970x0. That produces a zero size image. Also your order may not be good, although imagemagick 6 is forgiving.

This works for me on Unix and is more correct syntax:

Code: Select all

convert example-good-image.jpg \
-resize "927>" \
-crop 927x927+0+0 +repage \
-gravity center \
-extent 927 \
-quality 90 \
-synchronize \
result.jpg
In Windows it would be

Code: Select all

convert example-good-image.jpg ^
-resize "927>" ^
-crop 927x927+0+0 +repage ^
-gravity center ^
-extent 927 ^
-quality 90 ^
-synchronize ^
result.jpg

Joshva
Posts: 7
Joined: 2016-03-31T19:58:32-07:00
Authentication code: 1151

Re: After image resize new images are partially greyed out

Post by Joshva » 2017-06-19T04:45:47-07:00

Hi thanks for the reply, very helpful a couple of additional notes:

1) It does not always fail, it seems random as to which image it fails in i.e. if i re run it, it normally works
2) It only happens under load i.e. when i'm running 100 at a time
3) I am using im4java to pass the commands to convert, so please excuse my crop syntax, im4java probably changes it to what you have
4) My version is: ImageMagick 7.0.5-5 Q16 x86_64 2017-05-07

The tmp directory sounds interesting, is there any size limit on it? There is a tone of storage space on the machine its running on

snibgo
Posts: 9249
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: After image resize new images are partially greyed out

Post by snibgo » 2017-06-19T05:24:03-07:00

I suspect the "-synchronize" setting takes effect only after it is given, so it should be the first option.
snibgo's IM pages: im.snibgo.com

Joshva
Posts: 7
Joined: 2016-03-31T19:58:32-07:00
Authentication code: 1151

Re: After image resize new images are partially greyed out

Post by Joshva » 2017-06-19T06:18:29-07:00

Ah i will try that

gijs van der meijde
Posts: 1
Joined: 2017-07-11T04:21:33-07:00
Authentication code: 1151

Re: After image resize new images are partially greyed out

Post by gijs van der meijde » 2017-07-11T04:23:51-07:00

Dear,

Can you please show me how you called imagemagick using java?
I am having a LOT of trouble with it.

Post Reply