0

I have an image file of webP format. How can I check if it is animated webP or a static image programmatically?

2 Answers 2

0

Since you added fresco tag to the question, you could use the following utility:

ImageFormatChecker.getImageFormat_WrapIOException(encodedImage.getInputStream()) should return ImageFormat.WEBP_ANIMATED

https://github.com/facebook/fresco/blob/master/imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java#L125

Sign up to request clarification or add additional context in comments.

Comments

0

Here are some methods to get formats. Good thing is it identifies animation in webp. (mimeType and extention are same for animated and static type of webp, png, avif images)

InputStream is = ... ;
ImageFormat format = ImageFormatChecker.getImageFormat(is);

or

String uri = ... ;
ImageFormat format = ImageFormatChecker.getImageFormat(uri);

or

InputStream is = ... ;
ImageFormat format = ImageFormatChecker.getImageFormat_WrapIOException(is);

Used Fresco version : 3.1.3.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.