TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: gif.js - Fast GIF encoder using web workers

63 pointsby rwinnabout 12 years ago

5 comments

pornelabout 12 years ago
That's cool. Have you tried to make GIF compression lossy?<p>The idea is that when looking for longest match in the dictionary you don't match colors exactly, but instead allow some difference. That can reduce file size by 20-30% (here's my take on it in C: <a href="https://github.com/pornel/giflossy/commit/5a9adbc0feb899a228ed068a0deec6fc1b954a85?w=1#L0L245" rel="nofollow">https://github.com/pornel/giflossy/commit/5a9adbc0feb899a228...</a>)<p>Another optimization is to set pixels that are similar between frames to transparent color. That sometimes massively improves quality, as you only generate palette for part of the image (so the palette is better) and several frames overlaid together may give more than 256 colors.
评论 #5738505 未加载
leeoniyaabout 12 years ago
this is potentially exactly what i've been looking for. i posted about where i ended up, using screen recording to capture canvas animations to gifs just a week ago <a href="https://news.ycombinator.com/item?id=5691742" rel="nofollow">https://news.ycombinator.com/item?id=5691742</a><p>this may not work for me though because i need to record a css-scaled, hard-edges (pixelated) canvas. (which works in ff but not in chrome) and want to do this at 60fps, so on each reqAnimationFrame.<p>maybe i can disable imagesmoothing on the canvas and scale each frame via callback before encoding it.
评论 #5738855 未加载
评论 #5738133 未加载
评论 #5738357 未加载
zokierabout 12 years ago
I guess "fast" is bit relative. I get reported 1-3 second render times, meanwhile imagemagick converts the image from png-&#62;gif in about 40 milliseconds.
zombioabout 12 years ago
This will save me so much time, thank you!
workbenchabout 12 years ago
Sites down at the minute, hows it stack up to omggif <a href="https://github.com/deanm/omggif" rel="nofollow">https://github.com/deanm/omggif</a> ? Example of that with web workers here : <a href="http://gifpaint.com" rel="nofollow">http://gifpaint.com</a>