animation converted from tgs using python-lottie may produce corrupted image
Closed this issue · 3 comments
Discovered from: #4
An issue is opened upstream: https://gitlab.com/mattbas/python-lottie/-/issues/99
I noticed this when converting the "Colored Cats" Telegram sticker pack to .apng.
Like you've already reported upstream, I noticed that about half of the stickers from that sticker pack had visual glitches where some of the layers weren't rendered in the converted file. I've attached a couple of examples below.
Converted, with missing layers:
Hopefully the upstream are able to look into it sometime in the future.
Thanks for reporting this and for all your help.
I have written rlottie-python, which provides ctypes binding to librlottie for rendering tgs animation to bitmaps. It should be more reliable than lottie
python module.
v1.8.0 now uses rlottie-python for converting tgs to bitmaps image / animation.
@azuredusk10 you may have a try
From my initial testing, this bug looks fixed in v 1.9.6. The converted stickers don't have any visual corruptions, and also, they are compressed at a higher quality.
I converted the same "Colored Cats" sticker pack from .tgs to .apng for Signal, changing the minimum acceptable fps in the Signal preset to 15. Previously when I did this, the conversion failed for most stickers because the filesize was too large. However, in this version, none of the stickers failed. The animations in the converted stickers were super smooth and the resolution and colours looked brilliant.
I'd recommend changing the Signal preset so that the minimum accepted fps is higher. For me, a minimum acceptable fps of 15 worked well. The default value of 1 produced some very choppy animations.
With a minimum fps of 15, the tool lowered the resolution more than the frame rate in order to compress the image. Our eyes are more sensitive to frame rates than image resolutions, so an animation with a higher frame rate and a lower resolution will look better to most people than the same animation with a higher resolution and a lower frame rate.
I'll convert a few more Telegram stickers with minimum fps set to 15 and see how it goes.
For your reference, here is the converted "Colored Cats" sticker pack.
Signal conversion preset, modified so that the minimum fps was 15.
6 steps.
Incredible, incredible work. Can't wait to convert some more packs with this. Thank you!