8 Replies Latest reply on Apr 9, 2017 7:42 AM by c.pfaffenbichler

    Find image Vertices

    vasanthakumar L

      Hi Guys,


      How to export image vertices data (each x=?, y=?)? Here I attached the image this explain exactly what i want.






        • 1. Re: Find image Vertices
          Bahaar Khan Level 4


          Hit Cmd + T to get the transform controls. The control bar up at the top will have the x and y values.

          • 2. Re: Find image Vertices
            c.pfaffenbichler Level 8

            You may have to explain what you really mean.

            Do you rotate/otherwise transform Layers/Smart Objects/Shapes/… and in which form do you need the coordinates afterwards?


            By default Photoshop files’ zero-point is the upper left corner by the way.

            • 3. Re: Find image Vertices
              vasanthakumar L Level 1

              Hi pfaffenbichler,




              I want to know about the exact x, y positions of every break points. These values should be given to the scripting side. When i export the trimmed image (png image) its appear square or rectangle shape, because i can't export exact shape of that specified object. So i need to tell every vetice points x,y positions. Here i attached the sample image.vertex_points.jpg


              • 4. Re: Find image Vertices
                c.pfaffenbichler Level 8

                So you are talking about Paths with corner points without Bezier handles?

                Are there multiple Paths or inly ever one per image?


                Getting PathPoint information can be done with a Script as well as creating a txt- or some other file, you may want to ask for help over at

                Photoshop Scripting

                • 5. Re: Find image Vertices
                  vasanthakumar L Level 1

                  Thanks for your reply.


                  Exactly! I want photoshop scripting for generate values of path position.




                  • 6. Re: Find image Vertices
                    c.pfaffenbichler Level 8

                    // 2016, use it at your own risk;

                    #target photoshop

                    if (app.documents.length > 0) {

                    var myDocument = app.activeDocument;

                    if (myDocument.pathItems.length > 0) {

                    var theArray = collectPathPointsInfoFromDesc (myDocument, myDocument.pathItems[myDocument.pathItems.length - 1]);

                    for (var m = 0; m < theArray.length; m++) {

                    alert (("subpathitem "+m+" has the following pathpoints\n"+theArray[m].join("\n")));




                    ////// collect path points coordinates //////

                    function collectPathPointsInfoFromDesc (myDocument, thePath) {

                    var originalRulerUnits = app.preferences.rulerUnits;

                    app.preferences.rulerUnits = Units.POINTS;

                    // based of functions from xbytor’s stdlib;

                    var ref = new ActionReference();

                    for (var l = 0; l < myDocument.pathItems.length; l++) {

                      var thisPath = myDocument.pathItems[l];

                      if (thisPath == thePath && thisPath.kind == PathKind.WORKPATH) {

                      ref.putProperty(cTID("Path"), cTID("WrPt"));


                      if (thisPath == thePath && thisPath.kind != PathKind.WORKPATH && thisPath.kind != PathKind.VECTORMASK) {

                      ref.putIndex(cTID("Path"), l + 1);


                      if (thisPath == thePath && thisPath.kind == PathKind.VECTORMASK) {

                            var idPath = charIDToTypeID( "Path" );

                            var idPath = charIDToTypeID( "Path" );

                            var idvectorMask = stringIDToTypeID( "vectorMask" );

                            ref.putEnumerated( idPath, idPath, idvectorMask );



                    var desc = app.executeActionGet(ref);

                    var pname = desc.getString(cTID('PthN'));

                    // create new array;

                    var theArray = new Array;

                    var pathComponents = desc.getObjectValue(cTID("PthC")).getList(sTID('pathComponents'));

                    // for subpathitems;

                    for (var m = 0; m < pathComponents.count; m++) {

                      var listKey = pathComponents.getObjectValue(m).getList(sTID("subpathListKey"));

                    // for subpathitem’s count;

                      for (var n = 0; n < listKey.count; n++) {

                      theArray.push(new Array);

                      var points = listKey.getObjectValue(n).getList(sTID('points'));

                    // for subpathitem’s segment’s number of points;

                      for (var o = 0; o < points.count; o++) {

                      var anchorObj = points.getObjectValue(o).getObjectValue(sTID("anchor"));

                      var anchor = [anchorObj.getUnitDoubleValue(sTID('horizontal')), anchorObj.getUnitDoubleValue(sTID('vertical'))];

                      var thisPoint = [anchor];

                      theArray[theArray.length - 1].push(anchor);




                    // by xbytor, thanks to him;

                    function cTID (s) { return cTID[s] || cTID[s] = app.charIDToTypeID(s); };

                    function sTID (s) { return sTID[s] || sTID[s] = app.stringIDToTypeID(s); };

                    // reset;

                    app.preferences.rulerUnits = originalRulerUnits;

                    return theArray;


                    2 people found this helpful
                    • 7. Re: Find image Vertices
                      vasanthakumar L Level 1

                      Great Thanks!

                      • 8. Re: Find image Vertices
                        c.pfaffenbichler Level 8

                        By the way: That Script only processes the last Path in the Paths Panel (because if a Shape Layer is selected its Vector Mask appears at the end of the list), if

                        • there are more than one Path or

                        • you want the active Path or

                        • …

                        you may have to adapt the Script.