Page 1 of 1

resize bug

Posted: 2008-10-01T06:49:34-07:00
by ahalamoda
Very strange problem when resizing a particular JPG image. After the resize, the binary file is much smaller, identify shows the same size. When displayed the image is very pixelized.
Seems to be some kind of resize bug/unsupported picture format ?

OS: CentOS 5.2 (Redhat 5)
convert --version
Version: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC

Test image: http://img72.imageshack.us/my.php?image=dscn0084ye4.jpg

identify DSCN0084.JPG
DSCN0084.JPG JPEG 1024x768 1024x768+0+0 DirectClass 1.1e+02kb

convert -size 800x600 DSCN0084.JPG test1.jpg

identify test1.jpg
test1.jpg JPEG 1024x768 1024x768+0+0 DirectClass 48kb

test1.jpg is very pixelized.

Trested also with ImageMagick 6.4.x, same strange results.

Re: resize bug

Posted: 2008-10-01T11:09:16-07:00
by magick
Add -quality 92 to your command line.

Re: resize bug

Posted: 2008-10-02T02:36:34-07:00
by ahalamoda
Thanks you, adding "-quality 92" helped. Still I don't understand the problem.

I use ImageMagick (through Ruby RMagick) to resize a lot of pictures. I don't explicitly set the quality, so it should be using the default, which is 75 as doocumented. It works for all images, but not for this particular one. Why?

When I resize the picture with -quality 75 it is not pixelized, it looks good. It seems to me that somehow setting quality is required for this picture or else it has a very low quality. Why just this picture?

Do you recommend setting the quality explicitly to 92 (or other value) for jpeg format to avoid such pixelized pictures?

Re: resize bug

Posted: 2008-10-02T05:59:07-07:00
by magick
ImageMagick determines the compression quality from the quantization tables. Your image had an estimated quality of 0 which caused the pixelation. In the mean-time we patched JPEG so that it will only use a JPEG quality if it can compute it without estimation. You should try ImageMagick 6.4.4-2, that has the patch, when its released this weekend.

Re: resize bug

Posted: 2008-10-04T06:48:29-07:00
by bablokb
Try

convert DSCN0084.JPG -resize 800x600 test1.jpg

instead of

convert -size 800x600 DSCN0084.JPG test1.jpg

Bernhard

Re: resize bug

Posted: 2008-10-06T01:45:17-07:00
by ahalamoda
Yes, sorry, I've noticed it too late, this is wrong in example with size/resize. I have used resize and the problem was with quality, so the hint with explicitly setting quality has really helped.