My script below saves animated .gif file from Photoshop, but with Looping = 1. I need Looping = forever.
There is a program, called Gifsicle http://www.lcdf.org/gifsicle/
It runs under the command line and does everything with GIF.
In my case, Gifsicle string looks like that:
C://gifsicle.exe --batch --loop=forever −−careful *.gif
Is it possible at all for Photoshop jsx script to run Gifsicle and convert the file on disk AFTER this jsx script saves this file to the disc?
If yes, can anybody help me to integrate the line above into my "saving gif" script below?
#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 + ".gif");
SaveForWeb(saveFile);
}
function SaveForWeb(saveFile) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.COMPUSERVEGIF;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 1;
sfwOptions.optimized = true;
sfwOptions.transparency = 1;
sfwOptions.ColorReductionType = ColorReductionType.SELECTIVE;
sfwOptions.dither = Dither.NONE;
sfwOptions.ditherAmount = 80;
sfwOptions.webSnap = 0;
sfwOptions.colors = 128;
activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
}
http://www.lcdf.org/gifsicle/