getting the anchorpoints in photoshop path

Started by johanwieland, August 05, 2015, 07:39:36 AM

Previous topic - Next topic

johanwieland

Hi,

it is possible to read the name of a path created with photoshop, example:
exiftool -path7d0 /pathto/file.psd
returns the name of the first path

a path should contains an array of anchorpoints, coordinates. Is it possible to grep those  coordinates with exiftool, like imagemagick's identify -verbose does in svg section of output?



Phil Harvey

I assume you have the "photoshop_paths.config" file installed?

Anything is possible given suitable decoding in the user-defined tag definition.  Currently the definition extracts only the name, but it could extract any other arbitrary information that you want.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

johanwieland

thank for your respons,
yes, i used now:
exiftool -config photoshop_paths.config -allpaths   "name of file.tif"

but don't understand what to change to get the array of anchorpoints instead of the name of the path.


Phil Harvey

#3
Hi Johan,

Quote from: johanwieland on August 05, 2015, 08:26:53 AM
but don't understand what to change to get the array of anchorpoints instead of the name of the path.

OK, I see you are going to make me do some work here.

I don't know how you want the anchor points presented, but attached is a config file that will print the anchor points for all Bezier knots.  The coordinates range from (0,0) for the top-left of the image, to (1,1) for the bottom-right (provided I am decoding them properly).

- Phil

Edit: Swapped x/y coordinates in anchor point output

Edit2: Patched code to avoid potential problem with paths having very long names
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

johanwieland

i say: wow,
great, this is very usefull,

exiftool -config ./anchors.config  -allpaths nameoffile.tif

output is now:
Path 7d0                        : pietjepuk (0.0577419,0.156774) (0.0577419,0.870968) (0.944194,0.870968) (0.944194,0.156774)
Path 7d1                        : heelbeeld (0,0) (0,1) (1,1) (1,0)

now it is possible to parse that and related to width and heigth to calculate the position in pixels

thank you very much.





Phil Harvey

Great.  Just one thing.  I was re-reading the Photoshop documentation and realized the x/y coordinates were swapped in the config file I posted.  (I meant for the horizontal component to come first, and I didn't realize it was the other way around in the path record.)  I have edited the config file in my previous post to fix this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Silvano

Hi Phil,

I'm newbye and very interested on ExifTool for copy path information from one file to another, but exists the possiblity of use an intermediate file? like export the path information on a .tmp file and in second time apply the .tmp to the same file without path? I was able to export the path to a file with -n option, but after my brain's gone on hold.

Regards,
Silvano

Phil Harvey

With the photohop_paths.config config file you should be able to copy the paths to any other file that supports Photoshop information.  If you want to create one from scratch, I would suggest maybe a .exv format file:

exiftool -config photoshop_paths.config -o out.exv -allpaths FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

patrickgh

Hi Phil,

your config file works great - thank you! Is there a way to merge it with the default "photoshop_paths.config" file which i am already using? I was trying it myself but i could not get it to work.

My goal is to retrieve the Path names and the coordinates seperated. For example with

exiftool -config photoshop_paths.config -allpaths file.tif
Path 7d0                        : test



and


exiftool -config photoshop_paths.config -allpathcoordinates file.tif
PathCoordiante 7d0                        : (0,0) (0,1) (1,1) (1,0)


Regards,
Patrick

Phil Harvey

Hi Patrick,

This is a bit tricky since what you suggest requires re-defining the way a specific Photoshop tag is converted.

However, we can use one of the cool (and rarely used) ExifTool features (the -userParam option) to control how the tags are converted:

exiftool -config photoshop_paths.config -allpaths FILE - path names only

exiftool -config photoshop_paths.config -allpaths -userparam anchor FILE - names and anchor points

exiftool -config photoshop_paths.config -allpaths -userparam anchoronly FILE - anchor points only

Attached is the config file to make this happen.  This updated photoshop_paths.config file will appear in the next ExifTool release.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

patrickgh