What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How can I create a specific action / batch?


Benjibop13

New Member
Messages
2
Likes
0
Hi, I'm new to this forum. I have a specific issue that i cant seem to resolve...

I have 200 tiffs in one folder (each tiff is named 'image 1-200') all without an alpha channel.
I have 200 different tiffs in another folder (named 'luma matte 1-200').

I've have copied the first images of the 'luma matte 1.tiff' (a black and white image) and pasted it into a newly created alpha layer in 'the image 1.tiff' channel window.

I save this out as a new tiff called 'composite 1' and it works in the way I require it to work.

How would I automate this process rather than having to do it individually for all the 200 files.
I'm not sure if this can be done with a series of actions/batch?

Any help would be greatly appreciated :-)

NB I dont want to use After Effects luma key as this isn't giving me the correct results.
 
This should be close...
Copy and paste the following script into ExtendScript Toolkit, this program is installed at the same time as Photoshop.

Run the script and that should combine all the tiffs.

Code:
#target Photoshop
app.bringToFront();
function main(){
var inputFolder= Folder.selectDialog ("Please select folder to process");
if(inputFolder == null) return;
var fileList = inputFolder.getFiles("image*.tif");
for(var z in fileList){
var Name = decodeURI(fileList[z].name.replace(/\.[^\.]+$/, ''));
var  num = Name.match(/\d+$/);
var toFind = File(inputFolder +"/"+"luma matte " + num + ".tif");
if(!toFind.exists) continue;
open(fileList[z]);
open(toFind);
activeDocument.selection.selectAll();
activeDocument.selection.copy();
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
createPasteChannel();
var saveFile = File(inputFolder+"/Composite " + num + ".tif");
SaveTIFF(saveFile);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
    }
}
main();
function SaveTIFF(saveFile){
tiffSaveOptions = new TiffSaveOptions(); 
tiffSaveOptions.embedColorProfile = true; 
tiffSaveOptions.alphaChannels = true; 
tiffSaveOptions.layers = true;
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW; 
activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE); 
}
function createPasteChannel() {
    var desc39 = new ActionDescriptor();
        var desc40 = new ActionDescriptor();
        desc40.putEnumerated( charIDToTypeID('ClrI'), charIDToTypeID('MskI'), charIDToTypeID('MskA') );
            var desc41 = new ActionDescriptor();
            desc41.putDouble( charIDToTypeID('Rd  '), 255.000000 );
            desc41.putDouble( charIDToTypeID('Grn '), 0.000000 );
            desc41.putDouble( charIDToTypeID('Bl  '), 0.000000 );
        desc40.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), desc41 );
        desc40.putInteger( charIDToTypeID('Opct'), 50 );
    desc39.putObject( charIDToTypeID('Nw  '), charIDToTypeID('Chnl'), desc40 );
    executeAction( charIDToTypeID('Mk  '), desc39, DialogModes.NO );
     var desc29 = new ActionDescriptor();
    desc29.putEnumerated( charIDToTypeID('AntA'), charIDToTypeID('Annt'), charIDToTypeID('Anno') );
    executeAction( charIDToTypeID('past'), desc29, DialogModes.NO );
};
 

Back
Top