NickeManarin / ScreenToGif

🎬 ScreenToGif allows you to record a selected area of your screen, edit and save it as a gif or video.
http://www.screentogif.com
Microsoft Public License
23.99k stars 2.2k forks source link

Colour reduction algorithm comparison #689

Open KybernetikGames opened 4 years ago

KybernetikGames commented 4 years ago

I just updated to v2.26.1 and tried out the new colour reduction algorithms and figured I'd give some feedback.

Neural Network says it's good for lots of colours and works reasonably for the main body of the video, but did really badly on the progress bar at the bottom (5 pixels):

neural-network

Octree gave me a smallest file size with a perfect progress bar and the expected colour banding. This is definitely the best one for my purposes.

octree

Saying Median Cut is "less good" is a bit of an understatement. Larger file size, screwed up colours, banding in the progress bar, and horrendous ghosting all in one:

median-cut

Greyscale looks good, but has the largest file size.

greyscale

Most Used Colours is pretty bad too, with poor colouring (as expected) and a different kind of artifacts on the progress bar. But at least it gave the second smallest file size.

most-used

byzod commented 4 years ago

Check the use global color table would help

This should be on by default I'd say, fix many color problem

But even with this on, the light green progress bar is dark green with Neural Network, strange...

This is what I got when capture you second gif (light green bar one with Octree)

Encode with Neural Network, 256 colors, global table, sample 1 Note that the progress bar is obviously darker than original gif, and have a black boarder now a1

Off topic. Have my thanks @NickeManarin, the new encoder is epic fast and have better performance than before! It's the best overall choice now (before gifski fix the flickring pixel issue :D)

NickeManarin commented 4 years ago

This should be on by default I'd say, fix many color problem

I still need to improve the global color palette building mechanism. Right now it only takes the first frame to build the palette. If a new color appears on any other frame, the color will look off-tone/strange.

But even with this on, the light green progress bar is dark green with Neural Network, strange...

Yes, because the light green color represents a tiny portion of the first frame. Neural takes that into account when deciding which colors to use.

Have my thanks @NickeManarin, the new encoder is epic fast and have better performance than before! It's the best overall choice now

You're welcome! :D

(before gifski fix the flickring pixel issue :D)

I'll take a look if a new version was released or not.

vatterspun commented 4 years ago

Greyscale looks good, but has the largest file size.

The grayscale issue is something I've seen with other compression tools (e.g. Riot image compression). I don't have any understanding why what seems like fewer colors would take up MORE room, but I never dug into it very far. It does seem like there are fewer things to store without specific colors.

NickeManarin commented 4 years ago

@vatterspun The grayscale algorithm creates a global palette (it forces that, ignoring the checkbox) using all color slots available (selected via the "max colors" input).

vatterspun commented 4 years ago

@vatterspun The grayscale algorithm creates a global palette (it forces that, ignoring the checkbox) using all color slots available (selected via the "max colors" input).

Ah, thanks for that

byzod commented 4 years ago

Tested it more that I found this bug only occurs on new version (2.26)

This is the original gif t

This is 1.0 encoding (neuquant) of ver 2.23, quality 1 t-2 23-neuquant

This is 2.0 encoding (octree) of ver 2.23 t-2 23-octree

Both of them looks good enough

But things gone wild with new version of StG

This is Neural Network with use global color table of ver 2.26, sample 1 t-g

This is Neural Network without use global color table of ver 2.26, sample 1 t-ng

With global color table there's no color blinking which is good, but the overall color looks weird, especially bright colors (green bar at the bottom becomes dark, it can even be totally black if there are many colors in the image)

Without color table, the color blinks but at least it looks better overall, but strange things may happens on things like progress bar...