• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Find image Vertices

New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Hi Guys,

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

vertex.jpg

Thanks,

Vasanth

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 06, 2017 Apr 06, 2017

// 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.join("\n")));

}

}

};

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

function collectPathPointsInfoFromDesc (myDocument, thePath

...

Votes

Translate

Translate
Adobe
Enthusiast ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Hi pfaffenbichler,

Thanks.

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Thanks for your reply.

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

Thanks

Vasanth

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

// 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.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;

  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 || cTID = app.charIDToTypeID(s); };

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

// reset;

app.preferences.rulerUnits = originalRulerUnits;

return theArray;

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

Great Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 09, 2017 Apr 09, 2017

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines