Page 1 of 1

resolution problem

Posted: 2011-11-10T03:40:38-07:00
by srikrishnan
Hi All,

I have a requirement to convert set of tif images to jpeg format. For this purpose I have written a perl script. Through which I called image magick successfully. At the conversion stage 300x300 dpi resolution need to be changed to 150x150 resolution.

I have used -resample command for this purpose. Imagemagick shows the converted file correctly. But Windows image viewers and photoshop shows only the original resolution of the tif image.

I have read about the problem in imagemagick Documentation, it clearly explains that:

"Note that Photoshop stores and obtains image resolution from a proprietary embedded profile. If this profile exists in the image, then Photoshop will continue to treat the image using its former resolution, ignoring the image resolution specified in the standard file header."

How can I remove the proprietary embedded profile and make all the windows image viewers and photoshop to show the correct dpi?

Thanks in advance,
Srikrishnan

Re: resolution problem

Posted: 2011-11-10T10:25:21-07:00
by fmw42
I am not sure about this, but try using -strip after reading in the image.

see http://www.imagemagick.org/script/comma ... k4e2#strip

Re: resolution problem

Posted: 2011-11-11T21:09:22-07:00
by srikrishnan
Thanks for your suggestion,

I have tried the option "-strip" it reduces the 125KB file to 65KB, but even original resolution not shown by the "Windows Pictures and Fax Viewer" or any other windows softwares.

my syntax is as follows:

convert c:/sample.jpg -strip c:/sample.jpg

thanks,
Srikrishnan

Re: resolution problem

Posted: 2011-11-11T21:24:43-07:00
by fmw42
IM is changing the quality factor when you go from jpg to jpg. if it cannot determine the quality factor it uses a default of 92. Furthermore, it is not a good idea to go from jpg to jpeg as IM will decompress and recompress the image which will cause extra loss of quality as jpeg is not a loss-less compression. You can force the compression to higher or lower values using -quality. If you want a smaller file size, then use a smaller compression.

see
http://www.imagemagick.org/script/comma ... p4#quality

Re: resolution problem

Posted: 2011-11-13T22:40:27-07:00
by anthony
More than likely it is a separate 'resolution' setting from the images normal default. Photoshop especially likes to use its own resolution setting over and able the images normal resolution, that IM sets.

Re: resolution problem

Posted: 2011-11-14T01:43:46-07:00
by srikrishnan
Thanks for everyone,

now I have used the option "-strip" as follows:

convert -strip -density 150 -quality 80 "c:/sample.tif" +antialias -colorspace RGB "c:/sample.jpg"

it removes the embedded profile of photoshop and all the viewers shows exactly as per our requirement.

Thanks,
Srirkishnan

Re: resolution problem

Posted: 2011-11-14T20:02:48-07:00
by anthony
The +antialias is not needed. You don't make use of the setting.

Also the -strip should be placed after the image read (when you have an image in memory to strip.

Re: resolution problem

Posted: 2011-11-14T23:41:56-07:00
by srikrishnan
Hi Anthony,

thanks for your mail.

But in my case, as per i mentioned in my previous mail, if I use "-strip" after the image read, it will not stripped out the profile.

Thanks,
Srikrishnan

Re: resolution problem

Posted: 2011-11-14T23:44:10-07:00
by anthony
That seems strange to me!

Re: resolution problem

Posted: 2011-11-15T11:16:37-07:00
by fmw42
Was -strip change not too long ago to leave the profiles. I seem to recall something about that, though not completely sure. So perhaps one needs -strip +profile after reading the image.

Re: resolution problem

Posted: 2011-11-17T06:51:16-07:00
by jonrescca
For photoshop to respect the density set by imagemagick, we use the
+profile "8bim"
option

Code: Select all

convert -units PixelsPerInch input.tif +profile "8bim" -density 150 output.jpg