proof of concept: use upng-js to generate animated PNGs instead of GIFs #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
hello! While trying to make my generated GIFs smaller I ended up prototyping using upng-js to generate an animated PNG instead of a GIF. APNGs are supported by just about everything these days (unlike webp), and embedding seems to work just fine in slack & github, the main places I use terminalizer gifs.
I can't share my original test case for this as it contains stuff that's private to my employer, but file size went from a ~3mb GIF (~2mb when uploaded to gifoptimizer) to ~800kb as a PNG with a 128 colour colourspace.
I can share the following, though, although it is a bit contrived:
That's a 1.2mb png quantised to 256 colours (unquantised is 4mb). It took ~80s on my 2017 MBP to generate.
The GIF version is 16.2mb and took 12 minutes to generate.
As this is a proof of concept, there's a lot of changes here that I wouldn't normally put in a PR: running
prettier
over the files, not following your coding conventions, upgrading electron. There's also no option to generate a GIF and the quality flag does nothing - it's currently hardcoded in render.js to 256 colors max.If there's interest in getting this as a feature, let me know how you'd see it working, and I'll see if I can tidy this up.