phw / peek

Simple animated GIF screen recorder with an easy to use interface
GNU General Public License v3.0
10.3k stars 321 forks source link

Consider / propose as option / default to new lossy GIF encoder lossygif #291

Open ronjouch opened 6 years ago

ronjouch commented 6 years ago

It's that time again! (see #212 🙂). @pornel of ImageOptim/PNGQuant/gifsky fame just released a first version of lossygif (website, github). Quoting the website,

This is an encoder (based on gifsicle) which implements lossy LZW compression. It can reduce animgif file sizes by 30%—50% at a cost of some dithering/noise.

Example: 3.3MB original vs 1.2MB lossy recompression

3.3MB original 1.2MB lossy recompression

Would be awesome for Peek to be able to directly use it. As an option and maybe even by default, as it seems to output good-quality but very compact GIFs.

phw commented 6 years ago

Lol :) But yes, definitely. My main concern right now is how to structure the settings. I want to make it easy for the user to choose between different options without requiring extensive research.

ronjouch commented 6 years ago

@phw cool; good point, UX/discoverability matters! Thanks for the continued work on Peek 🙂.

kornelski commented 6 years ago

The settings can be reduced to:

[x] Fast conversion [x] High quality [x] Small file

Choose two.

aoloe commented 6 years ago

have you tested if lossygif also brings big advantages for "common" screen captures? as i understood the article i've read, it was mainly for compressing movie snippets (as in the example above)...

kornelski commented 6 years ago

It does help with screenshots a bit too, since anti-aliasing, icons and gradients can be lossily-compressed. It will have an annoying tendency of making completely flat and white areas look dirty, because when it has a choice of few white pixels vs few white pixels & one light gray one, the latter seems like better compression.

phw commented 6 years ago

@kornelski Thanks for the input.

I did some initial testing with a quick 15 seconds screen recording, converting a intermediary video file as generated by Peek with the options used by Peek. The video itself is a screen recording of this github issue tracker, so plain color areas, not too many colors (not the area where e.g. gifski shows its strength). The video frames are extracted to single files using ffmpeg and converted to gif using ffmpeg, gifski, gifsicle and giflossy. The file sizes:

Now I can use gifsicle / giflossy as a postprocessor on those outputs to further optimize them:

For ffmpeg:

For gifski:

So using giflossy would really bring the file size down significantly when using ffmpeg. It ads some extra post processing time, but I haven't done any measurements on this. If only gifsicle is available it doesn't help that much. Also adding giflossy as a post processor to gifski does not help much, but that was kind of expected.

I tend to just use giflossy if available as a postprocessor by default, and maybe add an option to disable it.

Here is the smallest of the files I could generate:

ffmpeg-gifsicle-lossy