Copy link to clipboard
Copied
Hey there!
I'm trying to save a bunch of PSD files as pngs but the script fails when saving, giving the error:
Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
- <no additional information available>
Line: 27
-> docRef.exportDocument(pngFile, ExportType.SAVEFORWEB, opts);
My script:
var allFiles = app.openDialog();
var allPSDs = new Array();
var fileMask = /\.(psd|)$/i;
for(var i = 0; i < allFiles.length; i++)
{
if (allFiles instanceof File && allFiles.fullName.search(fileMask) != -1)
allPSDs.push(allFiles);
}
for(var i = 0; i < allPSDs.length; i++)
{
var docRef = app.open(allPSDs);
var pngFile = new File(activeDocument.path.fullName + "/Export/" + docRef.name + '.png');
docRef.flatten();
var opts = new ExportOptionsSaveForWeb();
opts.format = SaveDocumentType.PNG;
opts.PNG8 = false;
opts.transparency = false;
opts.interlaced = false;
opts.quality = 100;
opts.includeProfile = false;
docRef.exportDocument(pngFile, ExportType.SAVEFORWEB, opts);
// also doesn't work / gives the same error:
// var pngSaveOptions = new PNGSaveOptions();
// app.activeDocument.saveAs(pngFile, pngSaveOptions, true, Extension.LOWERCASE);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
What did I do wrong?
UGH. I figured it out: the Export folder didn't exist.
What a stupid Error message for an error like this. Ugh.
Copy link to clipboard
Copied
Are there layers or is the PSD a 16 bit file. No layers allowed or 16 bit version in PNGs.
Copy link to clipboard
Copied
Nope, neither! I even flatten the image in the script
Copy link to clipboard
Copied
UGH. I figured it out: the Export folder didn't exist.
What a stupid Error message for an error like this. Ugh.