Copy link to clipboard
Copied
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.
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?
Alternatives include Slices from Guides and Save for Web without using layers:
These scripts allow one to specify the number of rows and columns without using guides:
...
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Thank you for your reply. I hope to use a script to split the images within the reference lines into multiple layers
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Thank you, that's exactly what I was looking for. I really appreciate it.
Copy link to clipboard
Copied
Thank you, that's exactly what I was looking for. I really appreciate it.
By @w30290083o9nn
You're welcome!
You had me a bit confused, the image that you posted was the result of the process, not the beginning of the process that you wished to automate. I thought that you wanted to copy the layered tiles, not the original background into tiles.
Copy link to clipboard
Copied
Sorry, my understanding is: the canvas on the left is the original image, and the layers on the right are the results after automation.
Copy link to clipboard
Copied
All good, we got there in the end!
Copy link to clipboard
Copied
Yes, your understanding is correct as well. We finally completed it. Thank you for your help.
Copy link to clipboard
Copied
Alternatives include Slices from Guides and Save for Web without using layers:
These scripts allow one to specify the number of rows and columns without using guides:
Copy link to clipboard
Copied
This is awesome, thank you so much.