Reputation: 1234
I want to compress large sized GIF image file(s) before sending them to the server for my chatting application (WhatsApp like feature).
Thanks in advance.
Upvotes: 6
Views: 2691
Reputation: 55
Lets come to basic and then compress the gifs, Gifs is a collections of images that run in a certain frame(15fps or 30fps), so if you want to compress a gifs you need to get the all the frame images then compress the images and then combine the images into a certain frame rate, one thing more gifs frame rate is different like in starting it's 15fps and at middle is 30fps and in the end 30fps, so make sure you track the frame rate in each second.
Next question is
how you get the all the images of the gifs? Answer: you can use Gifs Decoder class to get all the images
How you get the frame rate and gifs duration Answer: User Movie class, it's android build-in class for gifs processing. here you get frame rate, gifs duration
How you compress the each image, Answer: After using Gifs Decoder you get images in bitmap you can compress by resize the bitmap their height and width and using this link
Upvotes: 0