Hello everyone,
First post here, I'm new to Photoshop scripting. I try to make a function to export for the web like this :
function Export(saveFile, format, quality){
var saveOptions = new ExportOptionsSaveForWeb;
if(format === "png") { saveOptions.format = SaveDocumentType.PNG };
if(format === "jpg") {
saveOptions.format = SaveDocumentType.JPEG
saveOptions.PNG8 = false;
saveOptions.transparency = true;
saveOptions.interlaced = false;
};
saveOptions.quality = quality;
if(saveFile.exists === true) { saveFile.remove() };
activeDocument.exportDocument(new File(saveFile), ExportType.SAVEFORWEB, saveOptions);
};
It works fine but either I choose png or jpg, it exports the file as a png. Am I missing something? I can't find any issue like mine here or elsewere.
Before calling the function, I have a PSD with multiple artboards, it creates a new file for each artboards. Everything works fine.
Thank you for your help,
Victor