-
Notifications
You must be signed in to change notification settings - Fork 559
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
Animated sticker import #6
Comments
Why not apng? |
What about keeping them as lottie files and rendering them via https://github.com/airbnb/lottie-web? (And then of course shoving lottie support into all the clients as well... eventually) |
That would have to be the first step, not the eventually step |
🤷 This is a bit of a chicken/egg problem isn't it? I think this would be useful to have even with partial client support. |
Fluffychat can now render lottie files: https://gitlab.com/famedly/fluffychat/-/blob/main/CHANGELOG.md#v0340-2021-07-13 |
the comments on here sound unrelated, but the existing |
I don't understand why the images are force converted at all. If it supports the original image format, which from the thread it seems like it, then use it. I was encoding my stickers as lossless webps so they'd be better compressed, but apparently that's useless. Stickers are easily made 2x the size for no good reason. And if lossy formats are used, it would be even worse |
webp support is fairly recent on iOS, and the original format in question in this issue (lottie) isn't supported anywhere. The conversion could probably be removed now, but it won't help with this issue. |
Webps do support animations |
You can actually upload an APNG/WebP image as a GIF so that it's stored with Example sticker pack: You also need to disable PNG conversion, of course. Here's how I patched it: Oha-you@3eb61e4 Note: currently such animations won't play on mobile, at least in Element Android. It's an upstream issue (even for actual GIFs) |
The sticker picker itself does support gifs. You can upload a pack with gifs and it work fine. The only issue is that their is now moved preview. Because the import program of this repo does not support converting tgs to gif you need a different tool for this. |
I've played around with your suggestions and have implemented the changes from @Oha-you. I've added a stupid option to argparse so now you can add |
Oh and one weird thing is, that my stickers are not animated on my pack in the web, but if I send them in my chat, they are animated. Maybe my file format is wrong? I tried with webp and apng, both are not animated on the website, but in matrix chat they are. like in the example from @Oha-you :
|
@HerrFrutti Ah, that's probably because I've added this commit as well Oha-you@f71cce9 |
The preview is created by the selected matrix home server. It does only created a static image preview. |
Default solution did not work for me, animated stickers were converted to still pngs. I had to modify stickers/pack.py to not convert gifs, but upload them as is.
in else:
# dont convert only if its a gif
if path.endswith('.gif'):
with Image.open(path) as img:
width, height = img.size
else:
image_data, width, height = util.convert_image(image_data)
print(".", end="", flush=True)
mxc = await matrix.upload(image_data, "image/png", file)
print(".", end="", flush=True)
sticker = util.make_sticker(mxc, width, height, len(image_data), name)
sticker["id"] = sticker_id
print(" uploaded", flush=True)
return sticker Now the only problem is that .gif are sent as .png event. It works on matrix, but discord bridge bridges those as .png. So i had to manually change generated json file. |
Lottie files can be converted using https://github.com/sot-tech/LottieConverter like mautrix-telegram does. Probably need to convert to gif to make it work, even though that's not such a nice format
The text was updated successfully, but these errors were encountered: