Page 1 of 1

Make Photoshop Paths visible (Draw a line)

Posted: 2016-09-14T06:57:06-07:00
by patrickgh
Hi,

i am wondering if i can use ImageMagick to draw a line for a specific PhotoshopPath? If thats possible, can someone give me a hint? My current approach is to extract the path coordinates with exiftool and to draw a line based on this information. But it would be much more comfortable to do it directly with ImageMagick.

Thanks in advance!

Patrick

Re: Make Photoshop Paths visible (Draw a line)

Posted: 2016-09-14T09:16:54-07:00
by fmw42
What is your IM version and platform? Can you post and example file (presumably PSD or TIFF) that contains this path? You can post to some free hosting service such as dropbox.com and put the URL here. Is this a clipping path? If it is, then there may be a way. If it is not a clipping path, then I do not think IM know about simple lines within the PS meta data.

Re: Make Photoshop Paths visible (Draw a line)

Posted: 2016-09-15T00:49:00-07:00
by patrickgh
Hi,

i have uploaded a sample image here:
JPEG: https://dl.dropboxusercontent.com/u/406 ... allons.jpg
TIF: https://dl.dropboxusercontent.com/u/406 ... allons.tif

The image contains two paths: "crop" as a simple rectangle, and "path" as a more complex outline of the balloons. Currently there is no clipping path activated. The result i hope for is something like this:

"crop"-path:
Image

"path"-path:
Image

Currently i am using this version on Ubuntu 14.04:

Code: Select all

Version: ImageMagick 6.8.6-10 2014-01-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib djvu fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pango pangocairo png ps png tiff wmf x xml zlib

Re: Make Photoshop Paths visible (Draw a line)

Posted: 2016-09-15T06:24:32-07:00
by snibgo
"identify -verbose" can see only the rectangle path. We can extract this as an SVG file, edit the contents, and use it to draw a red rectangle over the balloons.

Windows BAT syntax, though "sed" is a unix tool. Doubtless there is a better way of doing the translations.

Code: Select all

%IM%identify -quiet -format "%%[8BIM:1999,2998:#1]" Luftballons.jpg >luft_clip.svg

sed -e s/fill:#00000000;/fill:none;/ <luft_clip.svg >l2.svg
sed -e s/stroke:#00000000;/stroke:red;/ <l2.svg >l3.svg
sed -e s/stroke-width:0;/stroke-width:3;/ <l3.svg >l4.svg

%IM%convert ^
  Luftballons.jpg ^
  -background none l4.svg ^
  -composite ^
  b.png

Re: Make Photoshop Paths visible (Draw a line)

Posted: 2016-09-15T07:47:09-07:00
by patrickgh
Wow, thank you, this works great. I tried to extract the other path informations with identify and stumbled upon these calls:

Code: Select all

# for the first path "crop" (rectangle)
identify -quiet -format "%[8BIM:2000,2998:#1]" Luftballons.jpg

# for the second path "path" (balloon outline)
identify -quiet -format "%[8BIM:2001,2998:#1]" Luftballons.jpg
Is that the right approach? I couldn't find documentation on how to extract 8bim Informations with identify so i did some try & error. Can someone confirm my approach and give an explanation for the syntax used? What does 2998 and #1 stand for? Is it safe to assume that the path order is always the same as in Photoshop?

Re: Make Photoshop Paths visible (Draw a line)

Posted: 2016-09-15T08:58:18-07:00
by snibgo
I think Dirk is the developer who handles this.

My understanding (which could be wrong) is that the numbers 1999,2998 are a range of resource identifiers to be examined. Only one of these will be written: the first one found, the second, or whatever.

So if you want all the paths, you should always use the range 1999,2998 but loop through the hash (#) numbers (from 1) until you find no more, eg:

identify -quiet -format "%[8BIM:1999,2998:#1]" Luftballons.jpg
identify -quiet -format "%[8BIM:1999,2998:#2]" Luftballons.jpg
identify -quiet -format "%[8BIM:1999,2998:#3]" Luftballons.jpg

See the IM code in property.c and the Adobe document http://www.adobe.com/devnet-apps/photos ... matashtml/