📜 ⬆️ ⬇️

Sneaky way to create animated jpeg


Today, he successfully carried out his experiment on compression of gifs. I have long been annoyed by the lack of a special format for compressing animated files. As so, there is a gif, but there is no animated jpeg, although jpeg is suitable for most existing gifs.

From existing solutions, mine differs in that it is a single svg file that can be inserted into the page through a tag.

Under the habrakat is a compressed version of this gif here tfirma.name/public/leprosorium.ru/cosss_gif/0004w00e.gif
The original weighs 6 megabytes, the compressed version is 1.3 megabytes.
')
Caution! This solution has a significant drawback, which is expressed in high CPU usage (about 25%). This happens only during file download, about 1-2 seconds, then everything returns to normal.




It works very simply. A great sprite is made in jpeg format. Inside the svg sprite is inserted into base64. Animation occurs by svg. No scripts.

Of the minuses, only this bug with CPU usage + non-support for the svg format by some browsers.
The brakes are probably related to base64 decoding and (at least to me) do not cause much inconvenience.

The advantages are obvious (compared to gif): faster loading, the color depth is not limited to 256 colors, which in turn avoids the posterization effect, writing a collector in this “format” is a rather simple task.

I would like to receive a feedback on the topic of take off / not take off, possible improvements + just entertain your CSW :)

Source: https://habr.com/ru/post/201444/


All Articles