gif.js
gif.js copied to clipboard
compute deltas between frames
if you look at http://i.imgur.com/wypWt11.gif in GIMP you'll see why it fits into 3.95k, each frame is a delta from the previous frame.
i did a screen record with lossless codec at 60fps, compressed with gifsicle, which computed the background, frame deltas and i think also removed identical frames (which may be fast to identify with a hash or similar) or maybe it merged identical frames into longer-delayed single frames.
the original image size was tiny, each square block is a pixel. so if #2 is addressed, this would probably scale & encode in a < 100ms.
for image diffs, there's https://github.com/HumbleSoftware/js-imagediff/ but by the looks of https://github.com/HumbleSoftware/js-imagediff/blob/master/js/imagediff.js#L166, it doesn't use typed arrays and compares at the sub-pixel level. i would be tempted to rewrite it for a considerable speed boost.
That's really cool. It might also be possible to port or gificles optimizer to js, or compile it with emscripten
https://github.com/kohler/gifsicle
feel free to draw inspiration from my fresh-from-the-oven implementation based on the omggif encoder
https://github.com/leeoniya/GIFter.js
cheers!
EDIT my lib still places full-size frames (w/ transparency fill), I'll add logic in a couple days to return cropped frames w/offsets from the diff algo...
Hi leeoniya , you did the great tool, is there any solution for this issue?tks
+1 Image file sizes are really large with gif.js by default