Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of animated sticker #78

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

xz-dev
Copy link

@xz-dev xz-dev commented Jul 16, 2024

Include lottie and webm
Fix #74

@xz-dev xz-dev force-pushed the master branch 2 times, most recently from 5742ac5 to 78ce8aa Compare July 16, 2024 23:14
Copy link

@charludo charludo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this PR! I am in no way associated with this project or repo, but discovered your fork yesterday and rebased on it. Apart from the two comments below, this works perfectly!

I'll be real, animated stickers have left me stuck with telegram for way too long, it's incredible that this is now possible. I can't imagine I'm the only one, so I'll sneakily ping @tulir to ask if this is on your radar? 👀

sticker/lib/util.py Outdated Show resolved Hide resolved
sticker/lib/util.py Show resolved Hide resolved
…hannel

In our testing, the method of exclusively processing the Alpha channel yielded the best results. This approach focuses on adjusting transparency while preserving the RGB color information, which prevents color distortion and maintains image detail. Key reasons for the improvement include:

- Protecting RGB from color alterations, avoiding color seepage and contamination.
- Precisely removing unwanted semi-transparency in the Alpha channel, eliminating white edges.
- Simplifying the process, reducing complexity, and minimizing risk of introducing new issues.

By targeting transparency issues directly in the Alpha channel, we achieve cleaner edges without compromising the image's color quality and detail.
@xz-dev
Copy link
Author

xz-dev commented Sep 15, 2024

I had find a way to improved conversion of semi-transparent pixels to GIF.

Anyone who needs it can test it

sticker-import https://t.me/addstickers/cybercats_stickers

Before
图片

After 86cb2ed
图片

@xz-dev
Copy link
Author

xz-dev commented Sep 15, 2024

Finally, we complete the WebM -> (remove PVx) WebP -> (remove semi-transparency) GIF / (detect static) PNG

More detail at: https://xzos.net/webm-webp-to-gif-with-semi-transparency/

@xz-dev xz-dev requested a review from charludo September 15, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError: 'StickerSet' object has no attribute 'animated'
2 participants