@Stefan34613976nwfa
This script worked for batch processing. It saves as PNG, that can be changed in the script, or you Automate > Batch action process or use Image Processor or Image Processor Pro etc. to bulk save other formats from the PNG:
/* https://community.adobe.com/questions%2D712/batch%2Dcrop%2Dstraighten%2D1101051 */
#target Photoshop
app.bringToFront;
var inFolder = Folder.selectDialog("Please select folder to process");
var outfolder = inFolder;
if(inFolder != null){
var fileList = inFolder.getFiles();
for(var a = 0 ;a < fileList.length; a++)
{
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) + ".png");
SavePNG(saveFile);
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
count++;
}
}
};
function CropStraighten()
{
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };
executeAction( sTID('CropPhotosAuto0001'), undefined, DialogModes.NO );
};
function SavePNG(saveFile)
{
pngSaveOptions = new PNGSaveOptions();
pngSaveOptions.embedColorProfile = true;
pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
pngSaveOptions.matte = MatteType.NONE;
pngSaveOptions.quality = 1;
pngSaveOptions.PNG8 = false; //24 bit PNG
pngSaveOptions.transparency = true;
activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
}
function zeroPad(n, s)
{
n = n.toString();
while (n.length < s) n = '0' + n;
return n;
};
- Copy the code text to the clipboard
- Open a new blank file in a plain-text editor (not in a word processor)
- Paste the code in
- Save as a plain text format file – .txt
- Rename the saved file extension from .txt to .jsx
- Install or browse to the .jsx file to run (see below):
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html