gifsicle should maybe not exit with status 1 when valid output is produced

Created on 3 Mar 2017  ·  3Comments  ·  Source: kohler/gifsicle

I use a kinda popular image server called Thumbor and it use gifsicle as an optional "engine" for doing all the gif things. Which is great.

However, sometimes people will upload gifs with something that gifsicle doesn't like ... so a 1 exit status is sent. Thumbor assumes if gifsicle exits with 1 that the output is invalid and will throw the result away.

Turns out that the output in at least the case I am test for is actually completely fine. Is there a way that gifsicle could differentiate between invalid output and just some error that didn't gifsicle from doing it's fine work?

Here is a crude example:

 ~/Desktop $ gifsicle --crop 0,0-629,349 huge.gif > huge_cropped.gif ; echo $?
gifsicle: warning: too many colors, using local colormaps
  (You may want to try ‘--colors 256’.)
gifsicle: background color not in colormap
1
 ~/Desktop $ gifsicle --crop 0,0-629,349 huge_cropped.gif > huge_cropped_incept.gif ; echo $?
gifsicle: warning: too many colors, using local colormaps
  (You may want to try ‘--colors 256’.)
0

source gif here (sportsball)

It might also be helpful to label the error message with "error:", otherwise it sorta just looks like info/debug level stuff.

Thanks!

Most helpful comment

I think these particular errors can be characterized as warnings. If you find other ones, let me know what they are. Thanks!

All 3 comments

I think these particular errors can be characterized as warnings. If you find other ones, let me know what they are. Thanks!

@kohler what about too many background color, it also exits with status 1.

gifsicle_osx --colors 256 --resize-fit 200x200 -o tmp/gifs/out.gif tmp/gifs/ttte.gif
gifsicle_osx:tmp/gifs/out.gif: background color not in colormap

one source gif: http://cdn.fatu.me/liZRzg1BORgSqoLNtemNf3-u3W_X

I think these particular errors can be characterized as warnings. If you find other ones, let me know what they are. Thanks!

@kohler Can you release new version with this fix. It's causing lot of problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hugovk picture hugovk  ·  7Comments

UmaMoiseenko picture UmaMoiseenko  ·  5Comments

jbaruch picture jbaruch  ·  3Comments

behlendorf picture behlendorf  ·  15Comments

SoreGums picture SoreGums  ·  6Comments