kohler / gifsicle

Create, manipulate, and optimize GIF images and animations
http://www.lcdf.org/gifsicle/
GNU General Public License v2.0
3.73k stars 236 forks source link

For animated gifs: gifsicle sets Photoshops SaveForWeb parameter "lossy" to 60 that cannot be changed. #120

Closed Cyril0001 closed 6 years ago

Cyril0001 commented 6 years ago

All my animated Gifs start to apear in a very poor quality after gifsicle. Exactly as if you set in Export Option - SaveForWeb - parameter "lossy" to 60. I cannot fight that. Nothing helps so far. Would be very grateful for any help!

kohler commented 6 years ago

Post a GIF that looks good; the command line you use to run gifsicle; and the result of running gifsicle.

Cyril0001 commented 6 years ago

That is how the saved file looks now: 5303

That is as it used to be: 5355

I use the script to batch save animgifs from photoshop. Nothing change, as to my current knowladge :) Here it is.

target photoshop;

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");
var rex = new RegExp(Name + "-" + layerName + ".gif");
var files = decodeURI(saveFile.fsName).replace(rex,"
.gif");
var cmd = 'D:/gifsicle.exe --batch --loop=forever --careful ';
cmd += '\"' + files+ '\"';
SaveForWeb(saveFile);
app.system(cmd);
function SaveForWeb(saveFile) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.COMPUSERVEGIF;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 0;
sfwOptions.optimized = true;
sfwOptions.transparency = 1;
sfwOptions.ColorReductionType = ColorReductionType.SELECTIVE;
sfwOptions.dither = Dither.NONE;
sfwOptions.ditherAmount = 80;
sfwOptions.lossy = 8;
sfwOptions.webSnap = 0;
sfwOptions.colors = 256;
activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
};

kohler commented 6 years ago

Running gifsicle --loop=forever on your input GIF produces an indistinguishable output GIF.

Most likely the problem is in your SaveForWeb function, which is doing a number of things, including reducing colors.

Bug reports are only accepted here that concern gifsicle; we can't debug your photoshop batch script. Good luck.