wrong quality setting of result when convert with thumbnail

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
lintianzhi
Posts: 6
Joined: 2013-08-01T01:02:21-07:00
Authentication code: 6789

wrong quality setting of result when convert with thumbnail

Post by lintianzhi »

when i convert a jpg file with thumbnail, the result quality setting resulting to fuzzy image, and if i set quality manually the result looks good.
so, i want to know how to get a suitable quality value when convert?
thanks.

remain is the image i test and how to reproduct it:

file: http://ztest.qiniudn.com/3SG0.jpg
the quality of original file is 22

convert with quality:
result file: http://ztest.qiniudn.com/q.jpg

Code: Select all

~/imagetest » convert 3SG0.jpg -thumbnail 357x -quality 100  q.jpg
~/imagetest » identify -verbose q.jpg| grep Quality
  Quality: 100
convert without quality:
result file: http://ztest.qiniudn.com/nq.jpg

Code: Select all

~/imagetest » convert 3SG0.jpg -thumbnail 357x   nq.jpg
~/imagetest » identify -verbose nq.jpg | grep Quality
  Quality: 22
i have posted it in Users, but i think it is more suitable in Developers, sorry for dup post
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: wrong quality setting of result when convert with thumbn

Post by glennrp »

ImageMagick preserves the quality setting if it can. Normally that's appropriate, but when the image is severely downscaled as you have done, the low quality becomes noticeable. The fix is to do what you have done, namely specify a higher quality (90 should be enough; it's half the filesize and visually indistinguishable to me).
lintianzhi
Posts: 6
Joined: 2013-08-01T01:02:21-07:00
Authentication code: 6789

Re: wrong quality setting of result when convert with thumbn

Post by lintianzhi »

glennrp wrote:ImageMagick preserves the quality setting if it can. Normally that's appropriate, but when the image is severely downscaled as you have done, the low quality becomes noticeable. The fix is to do what you have done, namely specify a higher quality (90 should be enough; it's half the filesize and visually indistinguishable to me).
I use a larger quality value, and let the value in the range [origin, origin*sqrt(original_size/result_size)] when the image is downscaled. For my program call convert not myself and i want get more smaller images as it can. thank you.
Post Reply