I have the script blow that saves JPG using a layer name. It works great.
I am trying to update this script so, that it would save animated GIF with "loop forever" option.
It would be just awesome if there is a possibility to set in the script quantity of GIF's colors (64, 128, 256), Transparency, Dithering and other parameters.
Any help would be very greatly appreciated!
----------------------------
#target photoshop
main();
function main(){
if(!documents.length) return;
try{
var Path= activeDocument.path;
}catch(e){var Path = "~/desktop";}
var Name = decodeURI(app.activeDocument.name).replace(/\.[^\.]+$/, '');
var layerName = app.activeDocument.activeLayer.name.replace(/[:\/\\*\?\"\<\>\|]/g, "_");
var saveFile= new File(Path + "/" + Name + "-" + layerName + ".jpg");
SaveForWeb(saveFile,80);
}
function SaveForWeb(saveFile,jpegQuality) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.JPEG;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 0;
sfwOptions.optimized = true;
sfwOptions.quality = jpegQuality;
activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
}