Moments
Moments copied to clipboard
Added an option to analyse a small sample of frames to create a single colour palette for the whole gif
I extended Moments for my own project, and I thought other people might find these changes useful, as I get more stable colours and substantially faster encoding time now.
What Moments does now: The existing version of Moments creates a new colour palette for every frame in a gif. NeuQuant is computationally expensive, so this makes encoding slow and, more importantly, it can result in "flickering" colours every frame when the NeuQuant operation quantises the colors slightly differently with a moving camera or changing colors on the screen.
What my additions do: My fork gives Moments the ability to sample several frames from a gif, analyze those frames together with NeuQuant, and create a single color palette that every frame will map to, without further NeuQuant calls.
I've added a "Frames Per Color Sample" field to the inspector, which allows you to sample every n-th frame in a recording for color mapping purposes. If the "Frames Per Color Sample" is set to zero, Moments reverts to its current default behaviour of creating a brand new color palette every frame.
The results: By setting "Frames Per Color Sample" to 6, for instance, I halved the encoding time for my 5.5 second gifs on Windows and I get rock-solid colours for the duration of my gif, without the frame-by-frame flickering I experienced previously.
BEFORE: (please note the flickering pinks and purples on some objects)
AFTER:
Whoa not sure how I missed this PR. That's a very nice addition, thanks for taking the time to implement it. I think the PR is missing a file though? See the inline comment.