-
Notifications
You must be signed in to change notification settings - Fork 659
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
Support animated image on iOS #2347
Comments
I think this is something we could support (no timeline) as I believe Skiko/Skia already support decoding GIF frames. We'd just need someone to write a custom |
@colinrtwhite Perhaps this could help? |
Upvoting 👍 |
Quite interested by this feature as well! Another possible source of inspiration, there is an optional component in jetbrains/compose-multiplatform that brings animated image support to Compose Desktop. From what I understand, Compose for iOS also uses Skia, so that could be a good starting point. |
Hey folks, I did a quick POC here (not production ready) to see how this could be done on non-Android platforms. It works OK, but for some reason the GIFs seem to lag a lot on desktop (I didn't test other platforms). You can test this yourself by checking out that branch and running No timeline for this to be released as I want to focus on releasing Coil 3 stable before settling on an API and productionizing this, but this can hopefully be part of a 3.1 or 3.2. If you need this ASAP, you can copy the rough EDIT: Added an option to prerender frames. It fixes the main thread choppiness, but significantly increases the decode time for long GIFs. I think we'll have to do something hybrid (decode a couple frames up front then try to decode the remaining frames just in time). |
@colinrtwhite That made my day, thank you! 🎉 I've tested your code on iOS, on my hobby project, with
Otherwise, everything played pretty smoothly! I wasn't particularly focused on performance, and tested with fairly small GIFs, so take that with a grain of salt. |
@outadoc / @colinrtwhite - guys, thanks for pushing this forward! 🎉 |
I've played with @colinrtwhite's POC a bit more and could get it to work with looping GIFs. Again, not production-ready, but seems to work okay for my use case 😄 Posting it here in case it helps for the final implementation or someone else's version. |
@outadoc |
@1060114835 I've hardcoded checks for GIFs in the snippet because I haven't tried the code on anything else than GIFs and I actually don't know where to find the formats supported by Skia. I wouldn't be surprised if it supports webp or APNG with very few changes |
@outadoc I try to load .webp image,it run! |
Is your feature request related to a problem? Please describe.
Any plans to support animated images such as gif/animated webp on multiplatform?
Describe the solution you'd like
Right now only Android platforms can play animated images, on iOS it will only show the first frame of the image
Additional context
The text was updated successfully, but these errors were encountered: