process dirs of images, filters w tiff out

Photoshop Script Snippets - Note: Full Scripts go in the Photoshop Scripts Forum

Moderators: Tom, Kukurykus

filmmaker

process dirs of images, filters w tiff out

Post by filmmaker »

tiffSaveOptions =new TiffSaveOptions();
TiffSaveOptions.alphaChanels=false;
TiffSaveOptions.annotations=false;
TiffSaveOptions.embedColorProfile=false;
TiffSaveOptions.imageCompression=TIFFEncoding.NONE;
TiffSaveOptions.layers=false;
TiffSaveOptions.layerCompression=LayerCompression.ZIP;
TiffSaveOptions.saveImagePyramid=false;

//set defaults
var files=new Array();
var srcdir=new Array("sc26_jeep",
"sc54_reveal",
"sc49_pan",
"sc50_pan2",
"sc53_jeep",
"sc57_dunes",
"sc59_fadeout");

var fmask='sc*.tif';
var i=0;

var input_dir="T:/4k_scans/"+ srcdir[j];
output_dir="N:/deN/"+ srcdir[j];

process = {};// create process object
process.defaultFolder = new Folder(input_dir );
process.mask = fmask;
//progress bar
var value = 0;
var win = new Window("palette{text:'Please wait...',bounds:[100,100,450,140]," +
"progress:Progressbar{bounds:[20,10,330,28] , minvalue:0,value:" + value + "}" +
"};"
);
process.processFile = function( doc ) {
var doc = open( doc );
var saveName = decodeURI ( doc.name );

doc.activeLayer.adjustLevels(0,200,1.0,0,255);
doc.flipCanvas(Direction.HORIZONTAL);
doc.activeLayer.applyDespeckle();
doc.activeLayer.applyDustAndScratches(4,21);
doc.crop([200, 100, 5800, 3900]);
var tiff_name = app.activeDocument.name.slice(0,-3) + 'tif';
var tiff_name = Folder (output_dir+ '/'+tiff_name );
doc.saveAs( tiff_name, tiffSaveOptions, true, Extension.LOWERCASE)
doc.close( SaveOptions.DONOTSAVECHANGES );
};

process.run = function(){
files = process.defaultFolder.getFiles( process.mask );
win.progress.maxvalue = files.length;
try
{
for (i = 0; i <files.length; i++)
{
process.processFile( files[ i ] );
win.center();
win.show();
win.hide();
win.show();
win.progress.value++;
}
}
catch (e)
{
alert(e)
}
};

process.run();