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
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
- Posts: 26294
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
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
Code: Select all
convert example-good-image.jpg ^ -resize "927>" ^ -crop 927x927+0+0 +repage ^ -gravity center ^ -extent 927 ^ -quality 90 ^ -synchronize ^ result.jpg
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
- Posts: 12938
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Can you please show me how you called imagemagick using java?
I am having a LOT of trouble with it.