Page 1 of 1

how to maintain quality of Source image after conversion

Posted: 2011-08-08T00:31:15-07:00
by pranay.samarth
Hi,

In my application (java based), I have to convert given image (.jpg only) from user to below 4 sizes and need to maintain the quality of the converted image same as originally supplied by user.

I am using below command -
convert -geometry 470x580 -unsharp 1.0x1.0+1.0+0.10 -quality 90 -map /sourceDirectory/colortable.gif /sourceDirectory /abc.jpg /targetDirectory/abc_size1.jpg

Issue – is there any way I can identify optimum size for the source image (user can share in aay size) so that I can apply above command for size changes and maintain the same quality.

Size 1 -
imageconversion.SMALLIMAGEHEIGHT=60
imageconversion.SMALLIMAGEWIDTH=40

Size2 -
imageconversion.NORAMLIMAGEHEIGHT=160
imageconversion.NORAMLIMAGEWIDTH=106

Size 3-
imageconversion.LARGEIMAGEHEIGHT=580
imageconversion.LARGEIMAGEWIDTH=470

Size 4 -
imageconversion.BANNERIMAGEHEIGHT=110
imageconversion.BANNERIMAGEWIDTH=100

Regards,
Pranay

Re: how to maintain quality of Source image after conversion

Posted: 2011-08-08T09:57:11-07:00
by fmw42
Any time you go from jpg to jpg you will lose quality as it needs to be decompressed and then recompressed and the quality may change due to different compression algorithms and quality settings between the input and output.

Also your syntax is old. Put your input image right after convert.

see http://www.imagemagick.org/Usage/basics/#why

also see http://www.imagemagick.org/script/comma ... hp#quality about default quality in jpgs

also your -geometry is doing nothing. Do you mean -resize? or -crop?

also I don't know that -map works on jpegs as it has too many colors, but I am not sure of that. I thought it was for use with gifs that have only 256 colors max.

Perhaps you can explain your command; that is what you are trying to do function by function.

Re: how to maintain quality of Source image after conversion

Posted: 2011-08-08T17:10:51-07:00
by anthony
-map works with any image. However JPEG will not store the exact colors that you mapped your image to! As such it is not generally useful with JPEG output.