Script debug - what's wrong with this picture?
I wrote a script a while back which shrinks and saves out images in png format. Nothing fancy. It works fine. I am happy. However yesterday, I discovered that it baulked at a certain file. Initally I thought it was a problem with the script (and that may be the case - i'm still new to scripting) but it worked with every other image I've thrown at it. Ergo it must be something wrong with the image.
Now here's the thing: I also noticed that adding a new layer underneath the existing single layer and then merging down allowed the script to work fine. So what is wrong with the inital image before it's had a new layer added and merged? Or what does adding and merging do to an image do to fix as I can't see any visual difference?
Here is the bare bones of the script:
// Set filePath and fileName to source path
filePath = "C:\\temp" + "/" + 'debugme' + '.png';
// save out the image
var pngFile = new File(filePath);
pngSaveOptions = new PNGSaveOptions();
pngSaveOptions.embedColorProfile = true;
pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
pngSaveOptions.matte = MatteType.NONE;
pngSaveOptions.quality = 1;
pngSaveOptions.PNG8 = false;
pngSaveOptions.transparency = true;
activeDocument.saveAs(pngFile, pngSaveOptions, false, Extension.LOWERCASE);
I would include the two psds (one that works and the one that doesn't) only this forum doesn''t seem to allow .psd files - and saving them out in another format is the whole problem.
