Copy link to clipboard
Copied
Script to do:
Can someone help me with this? This thing by using action's or even droplets will take me so much time. Is there is a way to automet this?
I have no scripting experience
Copy link to clipboard
Copied
The output filename, file format and resized sizes are not clear, however that is not too critical for now...
Although a custom script could be written, I'd first look at pre-made generic scripts, such as:
Image Processor Pro:
https://sourceforge.net/projects/ps-scripts/files/Image%20Processor%20Pro/v3_2%20betas/
Animated GIF example, a single run creating two different sizes:
If you are processing 1000's of input images into two output sizes, you will likely only wish to process one image folder at a time as you may experience memory related errors with so many files (Photoshop does not always gracefully handle "industrial" volumes of images when batching).
Copy link to clipboard
Copied
You may have to correct the Folder-path (I am not a Windows-user) and the Script saves only a direct jpg-copy for psd, psb and tif and names it »large.jpg«.
But figuring out how to include jpg into the images to be processed and create the second jpg might be good practice for you.
Just make sure not to inadvertently edit the original.
// saves jpg into folder "offer" next to folder containing image;
// be advised: this overwrites existing jpgs of the same name without prompting.
// 2022, use it at your own risk;
var thePath = "Y:/products";
var theFiles = retrieveFiles (Folder(thePath), []);
// jpg options;
var jpegOptions = new JPEGSaveOptions();
jpegOptions.quality = 9;
jpegOptions.embedColorProfile = true;
jpegOptions.matte = MatteType.NONE;
// process files;
for (var m = 0; m < theFiles.length; m++) {
var thedoc = app.open(theFiles[m]);
// getting the name and location;
var docName = thedoc.name;
var basename = docName.match(/(.*)\.[^\.]+$/)[1];
// getting the location;
var docPath = File(theFiles[m]).parent.parent+"/offer";
if (Folder(docPath).exists == false) {Folder(docPath).create()};
//save jpg as a copy:
thedoc.saveAs((new File(docPath+'/'+'large'+'.jpg')),jpegOptions,true);
thedoc.close()
};
//that’s it; thanks to xbytor;
////// get psds and tifs from subfolders //////
function retrieveFiles (theFolder, theFiles) {
if (!theFiles) {var theFiles = []};
var theContent = theFolder.getFiles();
for (var n = 0; n < theContent.length; n++) {
var theObject = theContent[n];
if (theObject.constructor.name == "Folder") {
theFiles = retrieveFiles(theObject, theFiles)
};
if (theObject.name.slice(-4).match(/\.(psb|tif|psd)$/i) ) {
theFiles.push(theObject)
}
};
return theFiles
};
Copy link to clipboard
Copied
@Mark-S – please let the forum know how you go...
Copy link to clipboard
Copied
Of course :), sure i do - just another (more important) task emerges from the abyss at the moment 😜 and this one is put aside for a time being.