Comments (5)
Unfortunately, this isn't very straightforward to support. Fresco uses native libraries to load animated WebP images on pre-Android P, which I'm against adding to the Coil main repo.
I think this would be a good candidate for an external repository that depends Coil. If anyone writes a Decoder
for this, let me know and I'll add it to the documentation.
from coil.
Hello @colinrtwhite! It's quite long ago, but I've done this recently using libwebp so I'm just letting you know as you said. đ
Check this out: https://github.com/skgmn/AnimatedWebPDecoder
Thank you.
from coil.
Hi @colinrtwhite
I suggest this repository https://github.com/penfeizhou/APNG4Android
we can decode Animated PNG and Animated Webp by using the code(Only Java code , no C,C++ ) from this repository and make a custom Coil's Decoder ourselves.
My Coil's decoder bases on Coil's 2.0.0-alpha01
Here is my demo:
AnimatedWebPDrawable-Release.zip
Here is my demo link : https://github.com/ShowMeThe/AnimatedWebPDrawable
The testing on phone :
The left one is Coil's Decoder using code from APNG4Android repository
, the right side is using Android Api ImageDecoder.decodeDrawable
Will it help Coil to support the Animated-webp or Animater-Png ?
Thanks you.
from coil.
@skgmn Sorry for the late reply, this looks awesome! I'll set up a list of external libraries and add it to the list.
@ShowMeThe Thanks for letting me know about this library! It looks like it could work well with Coil 2.0, which exposes ImageSource.file()
. Bonus that it's an 100% Java solution.
from coil.
@ShowMeThe I think it might be possible to simplify your animated WebP decoder to just:
class AnimatedWebPDecoder(private val source: ImageSource) : Decoder {
override suspend fun decode(): DecodeResult {
return DecodeResult(
drawable = WebPDrawable.fromFile(source.file().path),
isSampled = false
)
}
class Factory : Decoder.Factory {
override fun create(result: SourceResult, options: Options, imageLoader: ImageLoader): Decoder? {
if (WebPParser.isAWebP(result.source.file().path)) {
return AnimatedWebPDecoder(result.source)
} else {
return null
}
}
}
}
Though, I haven't tested the above code out.
from coil.
Related Issues (20)
- ByteArrayFetcher not saved on disk HOT 1
- java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied HOT 2
- add new decoder: coil3.svg.ResvgDecoder(use resvg to decode svg image) HOT 2
- æ°ćąæ”è§ćšćż«æ·æäœ
- Image is flickering in compose horizontal view HOT 2
- Update NetworkObserver to call connectivityManager.registerDefaultNetworkCallback instead of connectivityManager.registerNetworkCallback HOT 3
- Coil3 alpha-08 not compatible with ktor 3.0-beta02 HOT 2
- Turn off network cache, clear app file will not be able to load images HOT 1
- Investigate SieveCache as coil memory cache for better performance HOT 6
- Why does Coil always refresh when loading different images with the same URL by default? Is it a bug? HOT 1
- Support fonts on SVG files HOT 1
- ImageBitmap Support for multiplatform HOT 2
- coil-network-ktor3 version: 3.0.0-alpha09 causes Ktor HttpClient to crash HOT 2
- Green overlay on images with AVIF format HOT 5
- [wasmJS] Build Error. HOT 1
- [Coil-3] SVG flickering while scrolling HOT 2
- Coil 3: Differing APIs make writing multiplatform code fiddly HOT 3
- Coil disk cache doesn't work when loading an icon file manually HOT 1
- Coil with web view for caching image HOT 1
- [Coil 3] Frequent `ImageDecoder$DecodeException: Input was incomplete.` when displaying an Uri from the Android PhotoPicker in Compose Multiplatform. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. đđđ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â€ïž Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coil.