-
Notifications
You must be signed in to change notification settings - Fork 647
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
Telegram sticker packs with animated stickers fail to import #79
Comments
I can reproduce this problem with other Telegram sticker packs, for example: |
After quickly looking into the code, i think there may be a way to fix this. Animated Telegram Stickers use the WEBM format which apparently isn't compatible with the image conversion library used here. Maybe we can convert WEBM to another format like GIF with FFMpeg? Or maybe we can change the image conversion library to another one that supports WEBM. |
yes, I used pylottie, playwright, Pillow at https://pypi.org/project/pyrlottie/ (https://github.com/FHPythonUtils/PyLottie/blob/master/README.md) which help converting the .tgs sticker file to .gif file, which could be used here right? a quick demo code: import os def convert_single_tgs_to_gif(tgs_file, output_file): if name == "main":
|
Attempting to import any Telegram Sticker Pack with an animated sticker results in this error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/REDACTED/stickerpicker/.venv/bin/sticker-import", line 8, in
sys.exit(cmd())
^^^^^
File "/home/REDACTED/stickerpicker/.venv/lib/python3.12/site-packages/sticker/stickerimport.py", line 161, in cmd
asyncio.get_event_loop().run_until_complete(main(parser.parse_args()))
File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/REDACTED/stickerpicker/.venv/lib/python3.12/site-packages/sticker/stickerimport.py", line 153, in main
await reupload_pack(client, pack, args.output_dir)
File "/home/REDACTED/stickerpicker/.venv/lib/python3.12/site-packages/sticker/stickerimport.py", line 84, in reupload_pack
reuploaded_documents[document.id] = await reupload_document(client, document)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/REDACTED/stickerpicker/.venv/lib/python3.12/site-packages/sticker/stickerimport.py", line 36, in reupload_document
data, width, height = util.convert_image(data)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/REDACTED/stickerpicker/.venv/lib/python3.12/site-packages/sticker/lib/util.py", line 28, in convert_image
image: Image.Image = Image.open(BytesIO(data)).convert("RGBA")
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/REDACTED/stickerpicker/.venv/lib/python3.12/site-packages/PIL/Image.py", line 3498, in open
raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x74c06caf7600>
The sticker pack i tried is this one: https://t.me/addstickers/precure2
The text was updated successfully, but these errors were encountered: