-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 WebP support. #92
Comments
Hi, |
Just after some more tests, showing |
Yeah I think the current answer is probably a no. If you want to make a case for adding support a new issue can be opened. Animated gifs are supported, maybe you can use those. |
I'm going to turn this issue into a feature request. Seems like it might be possible at some point. |
@peteroid Hi there, could you please give more information about your tests? I can't display any webp image in my project. I ejected my project to pure RN, generated Podfile with import React from 'react';
import FastImage from 'react-native-fast-image';
const source = {
uri: 'https://user-gold-cdn.xitu.io/2017/12/28/1609d17b5af17a56?w=534&h=300&f=webp&s=39334',
};
export default () => (
<FastImage source={source} />
); It shows nothing. BTW, I tried the native code with SDWebImage it works fine:
project './test-webp.xcodeproj/'
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'test-webp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for test-webp
pod 'SDWebImage'
pod 'SDWebImage/WebP'
end
import UIKit
import SDWebImage
class ViewController: UIViewController {
@IBOutlet weak var imgView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
imgView.sd_setImage(with: URL(string: "https://user-gold-cdn.xitu.io/2017/12/28/1609d17b5af17a56?w=534&h=300&f=webp&s=39334"));
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
} |
Animated WebP works well in iOS currently. It does not work well on Android. We rely on Glide for support though so it doesn't seem possible to fix on our end. |
#542 Adds android support for animated webp using Glide integration library https://github.com/zjupure/GlideWebpDecoder |
Adding the following to the build.gradle adds WebP support:
|
are we be able to use animated WebP on Android now ? |
I got it working based on this PR (#542) (React-Native 0.61.5) I added the following to
Note: If this library ups its version you'll have to match the Specifically
|
Here is a list of glide webpdecoder versions: https://mvnrepository.com/artifact/com.zlc.glide/webpdecoder |
If any Expo user needs this, I've prepared some config-plugins for you: |
Just wanted to inform, the library has changed their group id, you now need to put this:
|
FastImage 8.6 uses glide version 4.12.0 ->
The webp decoder library suggest to use 2.3.(glide version). read at https://github.com/zjupure/GlideWebpDecoder And the version compatibility list on https://mvnrepository.com/artifact/com.github.zjupure/webpdecoder :
and if we consider glide version used in FastImage then compatible versions are. 2.0 : 2.0.4.12.0 I tried both type of versions nothing worked. |
Maybe I'm wrong, but from the readme.md:
So 2.3.4.12.x (or some later major version version with ...12.x) would need to be cloned and modified, unless Fastimage can use 4.15.1 (or 4.13.1 at least). |
This solution works like a charm. 👍🏼 🍭 😃 Solution 1: zjupure:webpdecoderdef glideVersion = safeExtGet('glideVersion', '4.12.0')
implementation "com.github.zjupure:webpdecoder:2.2.${glideVersion}" Solution 2: APNG4Android(supports APNG, AWEBP, AVIF, GIF) implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.28.0'
// Check the official documentation for the specific decoder. Solution 3: Upgrade Glide version (No 3rd party plugin)Glide 4.14.0 : changelog
Changing Glide version to 4.14.0 or 4.16.0(I have tried) in gradle of FastImage supports animated webp without any third party plugins - For Android P+ def glideVersion = safeExtGet('glideVersion', '4.16.0')
... - For older Android versions compatibility, implementation "com.github.zjupure:webpdecoder:2.6.${glideVersion}" Troubleshooting <FastImage source={{uri: uri, cache: 'web'}}/> |
No description provided.
The text was updated successfully, but these errors were encountered: