Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Combine 2 specific images, automatically

$
0
0

I work on PS CS4

 

I need to combine 2 images images into one (Both are in the same folder):

 

(The process must be applied to 2 sets of images)

 

set 1) A000.png / A001.png (Bottom layer, no changes)

set 2) B000.png / B002.png (Top layer, no changes)

 

I modified a script i found on this page:

combine three images into one but...

 

But i got error in the line 28 (Error 1233: Expected a reference to an existing File/Folder )

 

What i'm doing wrong?

Is there an easier way to combine two images?

 

Thanks

 

Here is the script:

 

#target photoshop

var myDoc = app.activeDocument;
var projectName = app.activeDocument.name;
var projectPath = app.activeDocument.path;

var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;

var num = 0;
var finished = 0;

for (i=97;i<=122;i++) {    var letter = String.fromCharCode(i);    var letter2 = letter.toUpperCase();    for (e=0;e<=100;e++) {              e = e;        numberCheck();        var targetName = letter2 + num + ".png";        if (targetName == projectName) {            e = e + 1;            num = e;            numberCheck();             targetName = letter2 + num + ".png";            var projectPath1 = new File(projectPath + "/" + targetName); //Change the "/" if your 50% opacity layer's file is in a sub-folder (ie: change "/" to "/50Opacity/")            var myDoc1 = app.open(projectPath1);                app.activeDocument = myDoc1;                var newLayer = myDoc1.layers.getByName("Background")                var copiedLayer = newLayer.duplicate(myDoc, ElementPlacement.PLACEATBEGINNING);                app.activeDocument = myDoc;                copiedLayer.name = "Layer 1";            finished = 1;                myDoc1.close(SaveOptions.DONOTSAVECHANGES);        }        if (finished == 1) { break; }    }    if (finished == 1) { break; }
}

function numberCheck() {          if (num >= 100) { num = e; }      if (num >= 10 && num <= 99) { num = "0" + e; }    if (num <= 9) { num = "00" + e; }
}

app.rulerUnits = originalRulerUnits;

Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>