resize bug

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
ahalamoda

resize bug

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: resize bug

Post by magick »

Add -quality 92 to your command line.
ahalamoda

Re: resize bug

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: resize bug

Post 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.
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

Re: resize bug

Post by bablokb »

Try

convert DSCN0084.JPG -resize 800x600 test1.jpg

instead of

convert -size 800x600 DSCN0084.JPG test1.jpg

Bernhard
ahalamoda

Re: resize bug

Post 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.
Post Reply