Gifsicle: How to set it to not overwrite the original GIF file if the resulting modified GIF file is larger than the original?
Posted
by
galacticninja
on Super User
See other posts from Super User
or by galacticninja
Published on 2012-04-22T10:39:20Z
Indexed on
2012/09/01
3:40 UTC
Read the original article
Hit count: 268
About Gifsicle:
Gifsicle is a command-line tool for creating, editing, and getting information about GIF images and animations.
One of its features is (from its website):
Optimize your animations! This stores only the changed portion of each frame, and can radically shrink your GIFs. You can also use transparency to make them even smaller. Gifsicle’s optimizer is pretty powerful, and usually reduces animations to within a couple bytes of the best commercial optimizers.
I call Gifsicle through this .BAT file in the Right Click - 'Send to' Menu:
@echo off
:compressFile
"C:\Programs\Compression Scripts\gifsicle\bin\gifsicle.exe" --batch -V -O3 %1%
echo.
echo.
SHIFT
if exist %1% goto compressFile
PAUSE
This animated GIF file, however: http://i.minus.com/i7WdodY5Zwot3.gif, when its compression is optimized with Gifsicle with the above commands, results in a larger-filesized GIF file. Gifsicle overwrites the original GIF file with the resulting larger-filesized GIF file.
Initial filesize: 7.57 MiB (7,942,886 bytes). After running through the above commands with Gifsicle: 7.64 MiB (8,017,622 bytes).
Is there a way to prevent Gifsicle from overwriting the original file if its output file is larger than the original file, while still overwriting the original file if the output file is smaller?
Details:
OS: Windows 7
Gifsicle version: 1.63, from the binary provided here: http://www.lcdf.org/gifsicle/
Gifsicle manual
© Super User or respective owner