Use the clipping path to clip? (TIF to PNG/command line)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
gabw
Posts: 28
Joined: 2014-07-20T09:20:15-07:00
Authentication code: 6789

Use the clipping path to clip? (TIF to PNG/command line)

Post by gabw »

Hi,

I want to convert an TIF with multiple paths to an transparent png. That works great if there is only one path in the TIF file.
But sometimes I have some tif files that have more than one path and than the "right" path to clip is marked as clipping path (can be seen in Photoshop as the bold one, screenshot below).

My command selects always the first path found in the tif file, clips it and saves it to a transparent png.

Code: Select all

convert input.tif -alpha transparent -clip -alpha opaque -resize 800x600 final.png
So how can I adjust this command to select the clipping path?

TIF File Download: http://gab3.de/share/tif_file_paths.zip

Photoshop:
Image

Result of my command: http://i.imgur.com/ho726fw.png (ImageMagick selected here "Pfad 2" instead of the marked clipping path "Pfad 4")
Wanted Result: http://i.imgur.com/G0dMvuH.png (made manually with Ps)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Use the clipping path to clip? (TIF to PNG/command line)

Post by snibgo »

Code: Select all

convert Fanta_Orange_05L_MW_PET_Kasten.tif -alpha transparent -clip -alpha opaque -resize 800x600 x.png
See http://imagemagick.org/script/command-l ... #clip-path
snibgo's IM pages: im.snibgo.com
gabw
Posts: 28
Joined: 2014-07-20T09:20:15-07:00
Authentication code: 6789

Re: Use the clipping path to clip? (TIF to PNG/command line)

Post by gabw »

And how can I automatically use the marked path without naming it? Or is there a way to get the name of the marked path?

Cause I need it to this this automatically on more than 10000 files...
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Use the clipping path to clip? (TIF to PNG/command line)

Post by snibgo »

Code: Select all

F:\web\im>exiftool -s3 -ClippingPathName Fanta_Orange_05L_MW_PET_Kasten.tif
Pfad 4
Does that answer the question?
snibgo's IM pages: im.snibgo.com
gabw
Posts: 28
Joined: 2014-07-20T09:20:15-07:00
Authentication code: 6789

Re: Use the clipping path to clip? (TIF to PNG/command line)

Post by gabw »

Thank you very much - that helped a lot.
Post Reply