Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

overlay two different images (batch)

New Here ,
Mar 15, 2016 Mar 15, 2016

is a simple way to batch process two folders of images so that say... Folder 1 Image 1 is overlaid on Folder 2 Image 1 to create a composite? I have a series of images I want to overlay on to each other but I am not sure if it's possible other than by opening each by hand which would take ages.

TOPICS
Actions and scripting
5.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Mar 15, 2016 Mar 15, 2016

You may want to ask over on the Scripting Forum, the task has come up repeatedly and can usually be automated but your description seems insufficient so far:

Photoshop Scripting

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2016 Mar 15, 2016

How do you want to composite them: two separate image in one image, or overlapping with some sort of blend mode or masking?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2016 Mar 15, 2016

I want to overlay one image on top of the other and blend with multiply or similar.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2016 Mar 15, 2016

You can do that pretty easily with scripting. Just a matter of defining the two folder, and making sure they are in the order you want. You can then use scriptlistener to get the code for placing a file into another. Then you put all the files from the folder in a new array with the getFiles() statement. then you create a loop to go through that array and open one of the files from one folder, then place a file from the other folder. You can then change the blend mode of the layer to whatever you want, and save and close, or what ever you want to do with the file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2016 Mar 15, 2016

Thank you. I have never done any scripting before, is there somewhere I can get more detailed information on the process and this particular script? Thank you so much.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2016 Mar 15, 2016

The other question would be: Do you want to stop at each image to do something, or just combining the photos, saving them, then going back later and do some editing? Stopping to do something is more complicated.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2016 Mar 15, 2016

I don't think I need to stop at each images as I only want to blend the two images together. So Image 1 from Folder 1 is blended as layer on to Image 1 folder 2. I hope that makes sense.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2016 Mar 16, 2016

Ok, the below script will combine files from two different folders then save the result to a third folder. You need to edit the script to point to folders that you have on your HD (lines 2-4). Thre is no error checking, so if you don't have the same number of files in each folder, it will stop and give you an error. If you have any other type of file other than an image file in the folder it will stop and give an error - this included XMP files, so if you're using raw files, change them to dngs first. Right now the script is set to set the top layer to overlay mode. You can change that in line 14.

#target photoshop

var folder1 = new Folder('/c/folder1/');

var folder2 = new Folder('/c/folder2/');

var saveFolder = new Folder('/c/folder3/');

var searchMask = '*.???';

var list1= folder1.getFiles(searchMask);

var list2= folder2.getFiles(searchMask);

var psdOptions = new PhotoshopSaveOptions();

psdOptions.layers = true;

for(var i=0;i<list1.length;i++){

    var doc = open(list1);

    var docName = doc.name;

    placeFile (list2, 100);

    doc.activeLayer.blendMode = BlendMode.OVERLAY;//change overlay mode

    doc.saveAs (new File(saveFolder +'/' + docName.split('.')[0] + '.psd'), psdOptions);

    doc.close(SaveOptions.DONOTSAVECHANGES);

    };

function placeFile(file,scale){

    try{

        var idPlc = charIDToTypeID( "Plc " );

            var desc2 = new ActionDescriptor();

            var idnull = charIDToTypeID( "null" );

            desc2.putPath( idnull, new File( file ) );

            var idFTcs = charIDToTypeID( "FTcs" );

            var idQCSt = charIDToTypeID( "QCSt" );

            var idQcsa = charIDToTypeID( "Qcsa" );

            desc2.putEnumerated( idFTcs, idQCSt, idQcsa );

            var idOfst = charIDToTypeID( "Ofst" );

                var desc3 = new ActionDescriptor();

                var idHrzn = charIDToTypeID( "Hrzn" );

                var idPxl = charIDToTypeID( "#Pxl" );

                desc3.putUnitDouble( idHrzn, idPxl, 0.000000 );

                var idVrtc = charIDToTypeID( "Vrtc" );

                var idPxl = charIDToTypeID( "#Pxl" );

                desc3.putUnitDouble( idVrtc, idPxl, 0.000000 );

            var idOfst = charIDToTypeID( "Ofst" );

            desc2.putObject( idOfst, idOfst, desc3 );

            var idWdth = charIDToTypeID( "Wdth" );

            var idPrc = charIDToTypeID( "#Prc" );

            desc2.putUnitDouble( idWdth, idPrc, scale );

            var idHght = charIDToTypeID( "Hght" );

            var idPrc = charIDToTypeID( "#Prc" );

            desc2.putUnitDouble( idHght, idPrc, scale );

            var idAntA = charIDToTypeID( "AntA" );

            desc2.putBoolean( idAntA, true );

        executeAction( idPlc, desc2, DialogModes.NO );

       

        }

    catch(e){}

    }//end function placeFile

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2018 Mar 27, 2018

Thanks for putting this together.  I've tried putting the above text into a .jsx file and running it as a script in PS CC 2018.  I just keep getting errors.  Am I running this the right way?

Screen Shot 2018-03-27 at 1.10.40 PM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 27, 2018 Mar 27, 2018

Remove the line numbering

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2018 Mar 27, 2018

Thanks!  That got it to run.  Sadly its not putting the layer from folder two and setting it to overlay.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 28, 2018 Mar 28, 2018

Follow chuck's instructions or specify your conditions

- wrong folder? try something like: '~/Desktop/Layers Test/Folder One'

- folders exist?

- same number of files?

- only image-files available in your folders?

- tested other blending mode (line 14) like MULTIPLY?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 17, 2019 May 17, 2019

Guys, I just found your post and this is what I would like to do also. Can you help me please a little bit? I'm on mac, I created the .jsx file an it gives me errors.

Error 8: Syntax error.

Line: 1

->  {\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf200

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 17, 2019 May 17, 2019

I'm not sure what you're doing. Are you using the above code? If so, don't use the line numbering, not sure what that first brace is for at the beginning of the line. If you're trying to replace a folder path into a variable, follow the examples above.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 17, 2019 May 17, 2019
LATEST

Looks like the text file is a rich text file, not plain text.

Prepression: Downloading and Installing Adobe Scripts

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines