Corrupted images (partial grey jpeg)

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
thrawney

Corrupted images (partial grey jpeg)

Post by thrawney »

Hi,

I don`t know if it's a bug with ImageMagick but here is our problem:

We are using ImageMagick in our photo Webservice (several thousand photos a day) and I would say that more than 99% of the time the pictures are resized correctly. The remaining 1% is composed of partial grey images (I guess corrupted image). We are using ImageMagick with ‘exec convert’ in a php script. We are able to get the error by redirecting the ‘stderr’ to ‘stdout’.
So basically it’s the resize function that seems to be the problem. If a specific image is corrupted, we are able to regenerate it using the same script with the same arguments so the problem is not the original photo.

My question is: is it possible that ImageMagick fail in the process of transforming an image, didn’t return any errors but returned an incomplete (partial) image?

Here are the versions of the software we use:
Php 5.0
ImageMagick 6.2.4 (We will update to the latest version as soon as possible)
Linux Ubuntu 6.06.1 LTS

Any hint will be appreciated,

Thanks a lot!
mpalmerlee
Posts: 1
Joined: 2013-08-01T12:27:16-07:00
Authentication code: 6789

Re: Corrupted images (partial grey jpeg)

Post by mpalmerlee »

I had this same problem and it turned out to be an error when I would process the images:
Corrupt JPEG data: premature end of data segment

But this error may have been caused by problems in the downloading of my images to process them (like it only had a partial image to download). Basically I was able to detect this condition in the code that calls imagemagick by listening to the sdterr and then retry the process on failure.

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

Re: Corrupted images (partial grey jpeg)

Post by fmw42 »

What error message did you get? Is the input image gray to start?

IM 6.2.4 is really very ancient (over 600 versions old). It is not surprising that there may be bugs that have been subsequently fixed. However, to be sure, it would be best if you could provide a link to an example image that fails and verify that a simple resize fails.

So something like

convert image.jpg -resize .... failedimage.jpg

It could also be an issue with the libjpeg.

Is the jpg image that fails in CMYK colorspace? IM generally works best in RGB colorspace. Perhaps you just need to convert to sRGB (with profiles or -colorspace sRGB) before the resize.
Post Reply