TIF to JPG, DPI and Clipping Path

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
eafalcao
Posts: 11
Joined: 2012-03-20T08:31:03-07:00
Authentication code: 8675308

TIF to JPG, DPI and Clipping Path

Post by eafalcao »

Hi...

I don't know if this is really a bug... however, here it goes:

I have the fowling image that I need to change dpi's, convert to jpg, and the width and heigth must remain as well as the clipping path: http://bayfiles.com/file/5Y0T/BStLBq/tif1.tif

I'm doing this:

Code: Select all

convert tif1.tif -resample 150x150 -resize 952x3424 tif_result_1.jpg
or

Code: Select all

convert tif1.tif -density 150 tif1_150.jpg
But when I see the Windows properties of the result images, the dpis remains 300 (like the original). The same thing happens when i open the image in Photoshop.
If I use -strip option, as i've read in some posts, the dpis is shown correctly... however the image lose the clipping path.

This only happens when i try to convert tif to jpg. If i convert jpg in tif everything goes well.

So, it's a bug or I'm doing something wrong?

Thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: TIF to JPG, DPI and Clipping Path

Post by fmw42 »

I can confirm on IM 6.7.6.1 Q16 that the image starts with 300 dpi according to the verbose info for resolution. then

convert tif1.tif -density 150 tif1_150.jpg

in IM, the verbose info show resolution of 150 dpi, but when you open the file in PS it shows 300 dpi.

Furthermore, when saving to tiff

convert tif1.tif -density 150 tif1_150.tif

IM verbose info still shows 300 dpi for the resolution of the output tif.
eafalcao
Posts: 11
Joined: 2012-03-20T08:31:03-07:00
Authentication code: 8675308

Re: TIF to JPG, DPI and Clipping Path

Post by eafalcao »

Does it only happens to me and to fmw42?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: TIF to JPG, DPI and Clipping Path

Post by anthony »

Photoshop (PS) does not use the 'offical' resolution or density of an image, if it sees its photoshop profile extension!

IM does not touch photoshop extensions, so if an image has one changing its resolution does not change the one used by photoshop. :-( Best idea strip that profile using +profile 8bim

See Basics, Density, Photoshop and Density
http://www.imagemagick.org/Usage/basics ... _photoshop

This is also pointed to from the TIFF common file format notes
http://www.imagemagick.org/Usage/formats/#tiff
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
eafalcao
Posts: 11
Joined: 2012-03-20T08:31:03-07:00
Authentication code: 8675308

Re: TIF to JPG, DPI and Clipping Path

Post by eafalcao »

Hi anthony... thank's for the answer.

However... by using "+profile 8bim" the result is simmilar when using "-strip": the resolution is changed, but the Clipping Path is lost. The original image has Clipping Path, and it's really important that it remains.

It seems that in my case, I simply cannot strip all the Photoshop profile because the Clipping Path is part of that profile.

And now?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: TIF to JPG, DPI and Clipping Path

Post by fmw42 »

You may be able to save profiles to a file by using -write photoshop.8bim, but I am not sure whether IM can put them back. You might look into EXIFTOOL, but I am not an expert on that and have not tried that. It may also be possible that EXIFTOOL (or some other non-IM tool) will be able to delete the density from the PS info leaving the clipping path.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: TIF to JPG, DPI and Clipping Path

Post by fmw42 »

From a PM between Anthony and myself:
anthony wrote:You can save profiles -write photoshop.8bim or at least that is my understanding.

But how would you put them back? Is there some way with or without IM? EXIFTOOL perhaps?

Code: Select all

 convert image   -profile 8BIM:photoshop.8bim  save_image
See the opening part of Profiles in IM examples
http://www.imagemagick.org/Usage/formats/#profiles

Profiles in IM is generally just treated as a data 'blob', which is just copied or transfered 'as is'.
Post Reply