Resized Images Created Via Photoshop Script Too Large File Size
I made a script to resize an image to widths at 4000, 7500, 9000. When exported the 7500/9000 are way too large as file sizes.
Like-
Manually increase size to 9000 width is 12 MB
Through script its 214 MB.
I tried to clear artefacts/metadata but it didn't work. I even tried to do each file individually instead of in a single for-loop but nothing worked. Any help is appreciated.
Here's my current script-
//Set Adobe Photoshop to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
app.displayDialogs = DialogModes.NO;
// first close all open documents
while (app.documents.length){
app.activeDocuments.close();
}
//input folder
var inputFolder = Folder('~/Downloads/RawPix');
var fileList = inputFolder.getFiles();
//output folder where images go when finished processing
var outputFolder = Folder.selectDialog("Choose Output Folder");
var pngOptions = new PNGSaveOptions();
pngOptions.quality = 5;
//iterates through folder
for(var a = 0; a< fileList.length; a++){
//opens file
var docRef= open(fileList[a]);
app.activeDocument = docRef;
// deletes old file extension
var fileNameNoExtension = docRef.name;
fileNameNoExtension = fileNameNoExtension.split( "." );
fileNameNoExtension.length--
//Changes width to 4000 while maintaing aspect ratio
docRef.resizeImage(7500,undefined,undefined,ResampleMethod.PRESERVEDETAILS);
//appends file extension and image size
var newOne = "/" +fileNameNoExtension+ "75.png";
docRef.saveAs(new File (outputFolder+newOne+".png"),pngOptions);
//closes open document
docRef.close(SaveOptions.DONOTSAVECHANGES);
}
