Highlighted

How to get the anchor point of smart object from script?

Community Beginner ,
Aug 05, 2020

Copy link to clipboard

Copied

I am using java script to parse the PSD file and generate layer information in another format. 

In target PSD, smart object layers are expected to be rotated/scaled with certain Anchor Point (Pivot) and it need not to be MIDDLECENTRE. In such case how can i calculate the Anchor Point from layer. I am using Adobe Photoshop CC 2020. 

Most Valuable Participant
Correct answer by JJMack | Most Valuable Participant

It hard to deal with Smart Object layer in a Photoshop Script unless the Script created the Smart Object for it the knows quite a bit about the  Object Smart Object layer Object Transform That it is not distorting or rotating the object. The  object transform may be  scaling the object but the script can scale it to 100% and get the bounds of  the layer know the object size.   

 

If the smart exist and your script did not create you may be able to use the code r-bin posted in this forum to the get  information about the existing Object transform.  You seem to  get the four corner points and the warping data.  If the four corners form a perfect rectangle the Object  may not currently be rotated or distorted but it could be rotated some multiple of 90 and the aspect ratio could have been  change to distort the object.

 

Here is a Smart object layer in a mockup.  Other Smart object Layer in the mockup share this smart Object.  Each Smart Object  layer has it own complex transform for the layer that transforms rotates and warps the object for the layer's use.  Look at the seat back transform and warp.  Wrapping is a transform option look at the transform tool option bar. 

Capture.jpg

Topics

Actions and scripting, How to, Import and export

Views

52

Likes

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

How to get the anchor point of smart object from script?

Community Beginner ,
Aug 05, 2020

Copy link to clipboard

Copied

I am using java script to parse the PSD file and generate layer information in another format. 

In target PSD, smart object layers are expected to be rotated/scaled with certain Anchor Point (Pivot) and it need not to be MIDDLECENTRE. In such case how can i calculate the Anchor Point from layer. I am using Adobe Photoshop CC 2020. 

Most Valuable Participant
Correct answer by JJMack | Most Valuable Participant

It hard to deal with Smart Object layer in a Photoshop Script unless the Script created the Smart Object for it the knows quite a bit about the  Object Smart Object layer Object Transform That it is not distorting or rotating the object. The  object transform may be  scaling the object but the script can scale it to 100% and get the bounds of  the layer know the object size.   

 

If the smart exist and your script did not create you may be able to use the code r-bin posted in this forum to the get  information about the existing Object transform.  You seem to  get the four corner points and the warping data.  If the four corners form a perfect rectangle the Object  may not currently be rotated or distorted but it could be rotated some multiple of 90 and the aspect ratio could have been  change to distort the object.

 

Here is a Smart object layer in a mockup.  Other Smart object Layer in the mockup share this smart Object.  Each Smart Object  layer has it own complex transform for the layer that transforms rotates and warps the object for the layer's use.  Look at the seat back transform and warp.  Wrapping is a transform option look at the transform tool option bar. 

Capture.jpg

Topics

Actions and scripting, How to, Import and export

Views

53

Likes

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 Beginner ,
Aug 05, 2020

Copy link to clipboard

Copied

layer.anchorPoint returns undefined

Likes

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
Reply
Loading...
LEGEND ,
Aug 05, 2020

Copy link to clipboard

Copied

Please explain what you are talking about; how is the anchor point defined, …? 

Maybe post a screenshot including the pertinent Panels to clarify. 

Likes

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
Reply
Loading...
Most Valuable Participant ,
Aug 05, 2020

Copy link to clipboard

Copied

It hard to deal with Smart Object layer in a Photoshop Script unless the Script created the Smart Object for it the knows quite a bit about the  Object Smart Object layer Object Transform That it is not distorting or rotating the object. The  object transform may be  scaling the object but the script can scale it to 100% and get the bounds of  the layer know the object size.   

 

If the smart exist and your script did not create you may be able to use the code r-bin posted in this forum to the get  information about the existing Object transform.  You seem to  get the four corner points and the warping data.  If the four corners form a perfect rectangle the Object  may not currently be rotated or distorted but it could be rotated some multiple of 90 and the aspect ratio could have been  change to distort the object.

 

Here is a Smart object layer in a mockup.  Other Smart object Layer in the mockup share this smart Object.  Each Smart Object  layer has it own complex transform for the layer that transforms rotates and warps the object for the layer's use.  Look at the seat back transform and warp.  Wrapping is a transform option look at the transform tool option bar. 

Capture.jpg

JJMack

Likes

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
Reply
Loading...