antimatter15 / jsgif

Save a HTML5 Canvas to GIF and Animations. A port of as3gif GIFPlayer to JS
http://antimatter15.com/
MIT License
1.07k stars 138 forks source link

Color Reproduction Issue #31

Open NaderCHASER opened 7 years ago

NaderCHASER commented 7 years ago

Creating an animated GIF, I'm having an issue with color reproduction. I suspect this is the quantization, as I'm able to successfully produce a screenshot from canvas using vanilla JS with no color reproduction errors.

encoder.setRepeat(0); encoder.setDelay(500); encoder.setQuality(1); encoder.start();

ah maps 2017-4-18 at 16 15 58

The logo color shifts per frame but should only be red and the radar images have on/off color blending issues.

Any advice on where to look is appreciated.

mpohl100 commented 6 years ago

Maybe my pull request might be worth a try. https://github.com/antimatter15/jsgif/pull/34

By default the sampling factor is 10 which means not all pixels serve as input for the neural net in NeuQuant.js. This way pixel colours can be lost. Setting it to 1 will ensure that the network is learning from every pixel

flyskywhy commented 1 year ago

You can try gifenc

Because my react-native-gifencoder is also some fork of gif.js

But in my react-native-runescape-text I replace react-native-gifencoder with gifenc for Fix when one color e.g. '#ff0000' only have 1 or 2 or 3 pixel in one frame, the generated gif pixel will be '#9f0000'; fix some frame not transparent but black; reduce gif size 10x