Skip to main content
Known Participant
July 25, 2024
Answered

How do I copy an image from the reference line to a new layer?

  • July 25, 2024
  • 2 replies
  • 1072 views

 

In an image, I have drawn reference lines using a newly created reference line layout, including both horizontal and vertical lines. How can I use a script to copy the images from these reference lines to a new layer? I have manually operated this in the image, and I understand the basic principle, but I'm unsure how to write it. My idea is to first obtain the coordinates of the reference lines, then check for the existence of either vertical or horizontal reference lines, and finally copy the images from the reference lines to a new layer. Thank you all for your help.

This topic has been closed for replies.

2 replies

Stephen Marsh
Community Expert
Community Expert
July 25, 2024

These "reference lines" are either known as a guide or guides – so for scripting and also just explaining things to other users, the correct and expected terminology is important. Here is some info on them from a legacy ExtendScript DOM .jsx scripting perspective (the new .psjs UXP scripting is different):

 

https://theiviaxx.github.io/photoshop-docs/Photoshop/Guide.html

https://theiviaxx.github.io/photoshop-docs/Photoshop/Guides.html

 

I can see that the layers and the guides have a relationship, however, it is unclear why you wish to use guides to copy layers. 

 

What is the problem that you are trying to solve with scripting? What is the starting point? What is the desired outcome?

Known Participant
July 25, 2024

Thank you for your reply. I hope to use a script to split the images within the reference lines into multiple layers

Stephen Marsh
Community Expert
Community Expert
July 25, 2024
quote

Thank you for your reply. I hope to use a script to split the images within the reference lines into multiple layers


By @w30290083o9nn

 

Something like this?

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-slice-a-very-large-poster/m-p/10998357