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
Make Photoshop Paths visible (Draw a line)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Make Photoshop Paths visible (Draw a line)
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)
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:
"path"-path:
Currently i am using this version on Ubuntu 14.04:
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:
"path"-path:
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
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Make Photoshop Paths visible (Draw a line)
"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.
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
snibgo's IM pages: im.snibgo.com
Re: Make Photoshop Paths visible (Draw a line)
Wow, thank you, this works great. I tried to extract the other path informations with identify and stumbled upon these calls:
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?
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
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Make Photoshop Paths visible (Draw a line)
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/
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/
snibgo's IM pages: im.snibgo.com