How can we resize the gif and animated webp files in android? I was able to decode the webp and gif using glide but could not find the solution for encoding them into webp.
Asked
Active
Viewed 1,270 times
-2
-
If size of the apk doesn't matter for you, you can use ffmpeg – Dmytro Rostopira Mar 05 '22 at 12:21
-
Thanks for comment. Yeah I could use that but I tried ffmpeg in React Native and achive the goal with gif files but cannot resize the animated webp file. I came to know that it does not have animated webp decoder so it can only resize the gif and encode to animated webp. – CrackerKSR Mar 05 '22 at 12:27
-
1I'm voting to close this question. Asking for "suggestions" makes it seem like you are asking for a library which is off-topic for SO. I suggest you either add more details, what have you tried, why did that not work etc, if this is really a *programming question*. Or, ask for a library on [Software Recommendations SE](https://softwarerecs.stackexchange.com). – Harald K Mar 07 '22 at 13:53
-
Found this question, it looks like it's possible: https://stackoverflow.com/questions/53024304 – Dmytro Rostopira Mar 29 '22 at 09:00
1 Answers
2
Finally I found the solution after lots of searching and exxperimenting.
For Gif:
- Extract frames from gif using decoder
- Resize the each bitmaps.
- encode them into webp or gif using encoder
For Webp:
- (Need Glid) use given code to extract frames as bitmaps.
- Resize them
- encode into gif/webp
(Delay is also available to use it with encoder)
Gif encoder decoder https://github.com/waynejo/android-ndk-gif
Webp Ecnoder https://github.com/b4rtaz/android-webp-encoder
Webp decoding using Glide: https://stackoverflow.com/a/64744296/9308731

CrackerKSR
- 1,380
- 1
- 11
- 29