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 to do a batch Auto Crop and Center ?


james2k12

New Member
Messages
2
Likes
0
Hi,

I recently scanned all my print photographs, three images per scanned TIFF file.

I want to utilize Photoshop's Auto Crop and Center feature found in File > Automate.

However, I can't figure out how automate more than once.

I have opened many .tiff files, and when I use Auto Crop/Center, it creates the three images. I can't seem to save them with Image Processing or Batch and needs to be done manually.

I have a ton of photos so I'm hoping Photoshop has a way to do this.

Ideally, I'd want to open a reasonable amount of Tiff files, execute something that would crop them all, and save them all into JPG's.

Any tips would be greatly appreciated. I have the old version of Photoshop CS5 if this matters. Tnx.
 
ummm, you need a script for that mate, but no fear Evil Nemesis is here :

#target Photoshop
app.bringToFront;
var inFolder = Folder.selectDialog("Please select folder to process");
if(inFolder != null){
var fileList = inFolder.getFiles(/\.(jpg|tif|psd|)$/i);
var outfolder = new Folder(decodeURI(inFolder) + "/Edited");
if (outfolder.exists == false) outfolder.create();
for(var a = 0 ;a < fileList.length; a++){
if(fileList[a] instanceof File){
var doc= open(fileList[a]);
doc.flatten();
var docname = fileList[a].name.slice(0,-4);
CropStraighten();
doc.close(SaveOptions.DONOTSAVECHANGES);
var count = 1;
while(app.documents.length){
var saveFile = new File(decodeURI(outfolder) + "/" + docname +"#"+ zeroPad(count,3) + ".jpg");
SaveJPEG(saveFile, 12);
activeDocument.close(SaveOptions.DONOTSAVECHANGES) ;
count++;
}
}
}
};
function CropStraighten() {
executeAction( stringIDToTypeID('CropPhotosAuto0001'), undefined, DialogModes.NO );
};
function SaveJPEG(saveFile, jpegQuality){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);
}
function zeroPad(n, s) {
n = n.toString();
while (n.length < s) n = '0' + n;
return n;
};

just make sure you change the extension in the script to whatever suites you like .jpg or .jpeg or .png etc.

hope it helps.
 

Back
Top