Skip to main content
December 22, 2015
해결됨

how to batch process, merging of 3 different images? i have action for merging and total of 240 different images.

  • December 22, 2015
  • 3 답변들
  • 672 조회

how to batch process, merging of 3 different images? i have action for merging and total of 240 different images.
is there any script for it?

as photoshop batch process is unable to identify 3 different images and merge those three images. Instead it performs the action on one image.

Thank you

이 주제는 답변이 닫혔습니다.
최고의 답변: c.pfaffenbichler

Currently i have grouped the three images in folders.
each folder has three images.

by any chance would that be possible to automate, in that way?

thank you.


edited

// 2015, use it at your own risk;

#target photoshop

var theFolder = Folder.selectDialog ("select folder");

if (theFolder) {

////////////////////////////////////

var theFolders = theFolder.getFiles(getFolders);

for (var a = 0; a < theFolders.length; a++) {

var theFiles = Folder(theFolders).getFiles(/\.(jpg|tif|eps|psd)$/i);

////////////////////////////////////

// open first image;

theFile = app.open(theFiles[0]);

var basename = theFile.name.match(/(.*)\.[^\.]+$/)[1];

// place other files;

for (var m = 1; m < theFiles.length; m++) {

placeScaleRotateFile (theFiles, 0, 0, 100, 100, 0, false);

// set to screen;

theFile.activeLayer.blendMode = BlendMode.SCREEN

};

// save as psd;

psdOpts = new PhotoshopSaveOptions();

psdOpts.embedColorProfile = true;

psdOpts.alphaChannels = true;

psdOpts.layers = true;

psdOpts.spotColors = true;

theFile.saveAs((new File(theFolder+'/'+basename+".psd")),psdOpts,false);

};

};

////////////////////////////////////

////// place //////

function placeScaleRotateFile (file, xOffset, yOffset, theXScale, theYScale, theAngle, linked) {

// =======================================================

var idPlc = charIDToTypeID( "Plc " );

    var desc5 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

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

    var idFTcs = charIDToTypeID( "FTcs" );

    var idQCSt = charIDToTypeID( "QCSt" );

    var idQcsa = charIDToTypeID( "Qcsa" );

    desc5.putEnumerated( idFTcs, idQCSt, idQcsa );

    var idOfst = charIDToTypeID( "Ofst" );

        var desc6 = new ActionDescriptor();

        var idHrzn = charIDToTypeID( "Hrzn" );

        var idPxl = charIDToTypeID( "#Pxl" );

        desc6.putUnitDouble( idHrzn, idPxl, xOffset );

        var idVrtc = charIDToTypeID( "Vrtc" );

        var idPxl = charIDToTypeID( "#Pxl" );

        desc6.putUnitDouble( idVrtc, idPxl, yOffset );

    var idOfst = charIDToTypeID( "Ofst" );

    desc5.putObject( idOfst, idOfst, desc6 );

    var idWdth = charIDToTypeID( "Wdth" );

    var idPrc = charIDToTypeID( "#Prc" );

    desc5.putUnitDouble( idWdth, idPrc, theYScale );

    var idHght = charIDToTypeID( "Hght" );

    var idPrc = charIDToTypeID( "#Prc" );

    desc5.putUnitDouble( idHght, idPrc, theXScale );

    var idAngl = charIDToTypeID( "Angl" );

    var idAng = charIDToTypeID( "#Ang" );

    desc5.putUnitDouble( idAngl, idAng,theAngle );

if (linked == true) {

    var idLnkd = charIDToTypeID( "Lnkd" );

    desc5.putBoolean( idLnkd, true );

  };

executeAction( idPlc, desc5, DialogModes.NO );

// get layerid;

var ref = new ActionReference();

ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("layerID"));

ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );

var layerDesc = executeActionGet(ref);

var layerID = layerDesc.getInteger (stringIDToTypeID ("layerID"));

// =======================================================

return [app.activeDocument.activeLayer, layerID];

};

////// get folders //////

function getFolders (theObj) {

if (theObj.constructor == Folder) {return true}

};

c.pfaffenbichler
Community Expert
Community Expert
December 28, 2015

If the files in each Folder share the same names the Script will overwrite the psd files it created with further Folders it processes, but you could change the line

theFile.saveAs((new File(theFolder+'/'+basename+".psd")),psdOpts,false); 

to use the folder’s name instead of the file’s name as the name for the resulting psd-file.

c.pfaffenbichler
Community Expert
Community Expert
December 27, 2015

Was the Script helpful in addressing the task?

December 28, 2015

Thank you for the script..

I transferred the java script to adobe photoshop scripts folder.
Clicked on the scripts through Photoshop and it requested to select the folder.

However, after i have selected the folder, nothing happens..

c.pfaffenbichler
Community Expert
Community Expert
December 28, 2015

Could you please provide a sample folder or a screenshot of the expanded Folder-structure?

What file format are the images?

Run on this Folder the Script created the psd files "1.psd" and "1_.psd" for me.

c.pfaffenbichler
Community Expert
Community Expert
December 22, 2015

Your description seems to be lacking clarity, how exactly can the three corresponding files be identified for example., what exactly is the Action doing, …?

If you do a Forum Search you may find the issue of automatically combining files via Script has come up repeatedly.

December 22, 2015

Thank you for the quick reply.
these are microscopy images obtained as 3 different images.
eg. image 1 is blue, image 2 is red, image 3 is green.

So i will have to merge these three images into one image, using screen blending mode.
The action was recording to blend these three image together.

However, i have 240 images that has different red, green and blue images that was to be merged together.
Finally if all has been processed i would have around 80 merged images.

I would like to have this process automated in photoshop or batched processed.
is there any method or scripts that would be helpful for me?

Thank you for the help.

c.pfaffenbichler
Community Expert
Community Expert
December 22, 2015

There are but you still have not told how the three images that belong together can be identified.