Script for annotating layer objects
Copy link to clipboard
Copied
Hello all. I'd like to know if it is technically possible to do this by script:
The steps:
1)Script run through all layers. Pick the first character of each layer
2)Create one text layer for each layer in a separated group with that first character (in the example case it's a number, on yellow markings)
3)Make sure the text isn't necessarily centered on the object (red dot on boundary blue) but touching an area with solid pixels of that layer.
Thanks in advance.
Explore related tutorials & articles
Copy link to clipboard
Copied
No.
Not All Layer contain pixels or are visible over a document canvas. Photoshop support many types of layers. A Photoshop Script can Process all layers in a document and do special processing of each layer type.
It look like you know nothing about scripting and may not know Photoshop well. If you want to script something like you seem to want to you will need to learn a lot. A programming scripting language like JavaScript. Learn Adobe's Photoshop Scripting DOM. Read the Adobe Tools Guidelines for Adobe Scripting. Install the Scriptlistener Plug-in to be to use Action Manager script Code as well as Adobe DOM code. Adobe Scripting
Copy link to clipboard
Copied
thanks JJMack. I do not know much about Photoshop Scripting nor am I planning to write this script but want to know if this is possible in scripting so I can pay someone to do it. I do know the Photoshop have many types of layers. I did not think of a script that could figure out what type of layer it is before acting. The script user would assume we are talking about a layer that contain solid pixels (100% opacity, except the edges maybe) and could even return an error if the script finds, say, a smart object layer or anything other than simple layer with an object there.
Copy link to clipboard
Copied
You need to design something that would be possible. What you wrote is to general a solution would not be possible. Adjustment layers can effect many layer. An added layer mask could hide the layer content in the center of it bounds where your text label indicator would be located. You are not going to be able to determine where a layer content over the canvas is and which one may be hidden by a layer mask. Scripts are slow you can not examine a layer pixel by pixel it would take forever and a day. You could have a layer the would be the black squares a a checker board. You may be able process a Shape Layer's vector mask it would not be easy and still the shape layer could have a layer mask added that hides most of the shape layer.
If you have a collection of layered documents that have a common design that could annotated like you want. You would need to design a logical process that can be programmed that implement you annotation.
Programs do not assume they are logical process. Also scripts have limitation The can only use some photoshop features and can not use Photoshop actual UI so thing you can do in Photoshop UI can not be done in a Photoshop script. Scripts can only change a document usineg the Photoshop features it can use.
Copy link to clipboard
Copied
Ok so if the script assume there is nothing fancy on the layers it could be annotated? Or do you mean the script do not have the means to know about smart object, masks, therefore can't be programmed? The script would be used in a collection of layered documents that have common design in a sense there would just ordinary layers with shapes (raster) on it, no mask, no adjustment layers, no smart object or texts, no vectors, nothing. Just plain ordinary visible layers with names structured as screenshot shows 1_1, 1_2... etc
Copy link to clipboard
Copied
Script can find out many things about Photoshop Objects like Layers, layer kind, Id, Name, Bounds, Stack position, Mask, visible, opacity, fill etc. With the proper code scripts can do many things, However the can not do everything Script can not perform magic. There are limits as to what scripts can do. You need to design a process that can with your logic do what you do with Photoshop UI to manually annotate your documents. Scripts can add layers and edit them to make a text layer and add text at some location x y location in the layer. If you do not have a collection of document that have a design in common and know what you want done with them. I surly do not know what you want to do.
Copy link to clipboard
Copied
Instead of text layers you may use also Annotations (notes) tool?
Copy link to clipboard
Copied
thanks, no just text layers

