Search code examples
androidimagecropanimated-gif

How can one crop an animated GIF on Android?


This is my first post on Stack Overflow, so I apologize if I am breaking the unwritten rules!! After much searching online I haven't been able to find a tool for cropping a GIF file. More specifically, I would like to crop a GIF with multiple frames. I would like the user of my app to be able to select a GIF from INTERNAL or EXTERNAL memory, then be able to crop a portion of it to capture the desired portion of the screen. I have minimum pixel dimension requirements that would require re-scaling the GIF if it does not meet the minimum size.

For instance, lets say the user selects a GIF that is 400 x 400, I would like a 300 x 320 subsection of the GIF to be cropped and saved. Are there any particular libraries to assist with this Activity?


Solution

  • You can use GifDecoder to get a bitmap for a frame and process it

    https://github.com/waynejo/android-ndk-gif/