Closed Meglali20 closed 2 years ago
Unfortunately this is a limitation of pyrlottie's basic functions - the preferable solution would require finding a gif library in c that supports transparency (write to 2 files - gif + webp)
This isn't an issue in pylottie however, the trade-off is that conversions take about 2 times longer. I'll create an issue in that lib and link back. Another option involves using the more advanced functions of pyrlottie but these are slower still (write to 4 files, and use pillow to diff the output to predict transparency, then write back to 2 files)
The issue linked provides a bit more info on the reasoning behind the decision
Didn't really get what you mean, it will take more time to convert if it keeps the transparency? is that what you meant? The latest version of telegram allows to upload some kind of videos and turn them into stickers like this pack https://t.me/addstickers/VitaminParty Seems that it's not working with that kind of sticker.
Basically, yeah - could add it in as a config option? I do plan on fixing this in the underlying library but I'm having a hard time getting things to compile at the moment (more learning required on my part I think)
Thanks for raising this, I can confirm that that pack contains webm images. Working on a fix for that. Just a note for future if that's ok, can you open new issues for different problems? That way it makes it easier for me to keep track of how broken my stuff is and will help anyone else who wants to follow along :)
Yes, having an option to wait longer to get the full pack without any issue would be great! it's better than nothing, the user would choose the conversion method that suits him.
Ok I've been looking at addressing the underlying issue, hopefully this will improve performance - just taking some time getting there
Tried to solve and the result ended up being very slow. There are a few things left to try but I cannot justify spending much more time on this.
Marking wontfix for now. But I'll keep the issue open as I may give this a final attempt
Did you try this? maybe it could help figure out something? https://gitlab.com/mattbas/python-lottie I did try it, but I get an non sense error about a missing module
Yeah that isn't suitable for this project. It requires Cairo which is a pain to install on windows and images had serious graphics issues.
I have two lottie libs, pylottie (uses Google Chrome) and pyrlottie which offers the speed improvements. I've been working on upgrading pyrlottie to handle transparency but there's still more work to be done. It's posed several technical challenges so I might update it. Depends on how development work goes as this has been quite a process
I hope I'll get an update out in the next couple weeks but if not I don't have an ETA as I'm getting fed up of spending so much time on it
Ok fell at the last hurdle on this one. Got comparable performance in initial testing but then was 2.5x slower in tstickers. There's nothing else I can think of doing to address this properly.
The work is at https://github.com/FHPythonUtils/PyRlottie/tree/experimental if you're interested
Going to close this now - sorry to disappoint
Can you add this to tstickers? it's still better than not working at all, adding it as an option would be fine, personally, I wouldn't mind waiting a bit for conversion to work properly since it wasn't taking that much time so 2.5 more time is still better than nothing.
Pretty sure a previous version did this (2021.2.1) If you don't care about it taking ages
I just tried the conversion by changing the code in the latest version, it works properly (waiting 1-3 minutes for conversion to complete) it's not that bad I still think you should keep it in the main version as an option in arguments, I have just one more concern, I had to save some information about the sticker and it seems like something changed in the last version AttributeError: 'Sticker' object has no attribute 'animated' I need to know if the sticker that is being saved is animated or static just from the object any way to know how?
Best bet would be to look at the type. If it's tgs or webm then it'll be animated
Animated stickers aren't saved with alpha transparency but all have a black background (also when converted to static png), only static stickers are saved with transparency, any solution for that?