Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proof of concept: use upng-js to generate animated PNGs instead of GIFs #143

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mipearson
Copy link

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:

render1607233878178

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.

@eabase
Copy link

eabase commented Dec 16, 2020

@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.)

@mipearson
Copy link
Author

@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.

@nmaiti
Copy link

nmaiti commented May 29, 2021

@eabase are you still working on it toward merge? png output can be optional based on output format /config file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants