Answer the question
In order to leave comments, you need to log in
How to run Gifsicle from a jsx script in Photoshop and convert a GIF file AFTER this script has written this GIF file to disk?
My jsx script (below) saves animated .gif files from Photoshop (adding the name of the current layer to the file name).
But, with one repetition Loop = 1. And I need it to repeat endlessly, i.e. loop=forever.
Saving directly from Photoshop with Loop=forever doesn't work because I need to convert the entire animation from timeline to frame animation. And at the same time, all the effects and other beauties are lost.
There is a Gifsicle program www.lcdf.org/gifsicle Works from the command line and does everything you need from a GIF.
In my case, it will convert a Gif with loop=1 to a Gif with loop=forever.
DILLETANT QUESTION: Is it possible to run Gifsicle from a jsx script in Photoshop and convert a GIF file AFTER this script has written this GIF file to disk?
If so, please help me insert the line
C://gifsicle.exe --batch --loop=forever −−careful *.gif
into this script in this way:
#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);
}
Answer the question
In order to leave comments, you need to log in
var objShell = new ActiveXObject("shell.application");
objShell.ShellExecute("gifsicle.exe", "--batch --loop=forever −−careful C:\\gifs\\*.gif", "C:\\");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question