: How can I number copies of Photoshop layers? In this video a girl has copied an image several times. When I do the same the following happens: "image" (copy 2) "image" (copy 1) "image" (source)
In this video a girl has copied an image several times. When I do the same the following happens:
"image" (copy 2)
"image" (copy 1)
"image" (source)
How can I number the layers without the copy-addition like in the video?
"image 2"
"image 1"
"image" (source)
I'm using Photoshop CC 2015.5.0 on Windows 10.
More posts by @Smith574
2 Comments
Sorted by latest first Latest Oldest Best
If you're interested in scripting, here's a sample script that adds numbers to duplicated layers:
It's not perfect, as we can see in the gif, after I click on number 4 and continue using the script, it increments the number based on the previously active layer. It could be modified to find all layers with a similar name and find the layer with the biggers number, but it would be incredibly slow in most real world situations where you got more than 10 layers. That's why this sample is made to be dumb.
var Doc = app.activeDocument;
Doc.suspendHistory( 'Duplicate With Numbers', 'init()');
function init() {
var Layer = Doc.activeLayer;
var LayerName = Layer.name;
var r = /(d+)/;
var LayerNumber = LayerName.match( r );
var newLayer = Layer.duplicate();
if ( !LayerNumber ) {
Layer.name = trim( LayerName) + ' 1';
}
Doc.activeLayer = newLayer;
if ( !LayerNumber ) {
newLayer.name = trim( LayerName ) + ' 2';
}
else {
LayerNameArray = LayerName.split( r );
newLayer.name = trim( LayerNameArray[0] ) + ' ' + ( parseInt( LayerNumber ) + 1 );
}
}
function trim (str) {
return str.replace(/^s+/,'').replace(/s+$/,'');
}
That's the default behavior it can not be changed. However you can make a plugin that monitors the scene and auto renames things on the fly not sure if its worth the time and effort, though.
However. if your ready to relax your requirement a bit renaming a bunch of layers after they are created without a sentinel to do it automatically is trivial be compression. This has probably been done to the death, let me google for a second:
Yes its been done in layerRenamer by Kamil Khadeyev for example
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.