terminalizer
terminalizer copied to clipboard
proof of concept: use upng-js to generate animated PNGs instead of GIFs
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.
@mipearson Super cool, but replacing is probably not what everybody wants. Why not make it as an option?
Also a lot of your PR is about changing the code formatting... That is never a popular thing to do.
(And I also don't agree with your prettyfying, making code much longer and using narrow screen width. Totally opposite of my own coding std's... IMHO.)
@eabase from the PR:
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.
Also why it's a draft PR - I'd like to see if there's interest from the maintainer before doing this properly. This was a couple of hours of hacking I chucked up here as a proof of concept only rather than a mergeable artefact.
@eabase are you still working on it toward merge? png output can be optional based on output format /config file