GIF quality generated in Android - android

I am making an app that generates GIF from images taken on camera.
I have used two libraries to generate GIF, this one and this one, but both generate GIF with awful quality. Image is posterized.
For example, here is the original image:
and here is the image generated by Gifflen library:
There are some apps on Google Store that generate GIF and don't destroy image quality. Is there a way to increase GIF quality (generation time increase is ok) or is there another library that can generate GIF?
EDIT
Like Wildopper said in the comment, it is probably dithering of the image that is causing the problem. Here is the explanation on Wikipedia, but I don't know how to implement it.

Related

Android image size reduction

I got an app which is loaded with many image files which takes much place. The app can also download more pictures from different sources. Is there a way to compress their size?
I remember there was maybe some sort of library created by Google specifically for this issue?

Image compression before uploading in android

I have a image uploading module in my app where user can select an image from the gallery. The problem is the size of the image can be upto 10MB. Which is very large, I want to apply some compression technique to these images before uploading them.
I did some research on the internet and found some libraries like ImageMagick, ImgMin which allows easy optimization of the images. Is there any way I can use them in my android project without the involvement of any backend server.
References:
ImgMin
https://github.com/rflynn/imgmin
ImageMagick
http://www.imagemagick.org/script/index.php
An easy option you can try is this method from the Bitmap class.
You can select the compression format of a bitmap and to optimise either the quality, or the file size. A downside is that the you need to get a Bitmap instance to start the compression, which may be something you don't want to do.

How to show webp animation in Android

I would like to use WebP format to animate GIFs as the alternative to native GIF format or MP4, but I have no clue how to actually decode it in Android and show it in the view.
The Giphy app could be used as the reference. I would like to achieve similar result with the webp animation.
I found a 3rd party library - Fresco (Facebook). It provides a view for the animation as well as animates it. But this library increases the build size by several(!) megabytes.
Does anybody have a solution or suggestion how to display the animated WebP animation on native Android (not in WebView)?
Thanks in advance!
The "several" megabytes of Fresco become one megabyte if you ship separate APKs for different CPUs. See the instructions.

In android and any mobile app, why is it launched in small sizes?

For example, when I created an app in android.
I included a image file in the app. When I added the image, the app's
file size increased exactly as image size.
But my question is, many apps in google play apps includes so much images but
why do they have so small amount of file size?
Is it that they don't use picture format and using drawing api like canvas?
Because there these images are not being stored in app memory, In runtime they are downloading the images and displaying in the application. So There application size is not that much big.
But in your application you are storing images in drawable folder that is why your app size is getting increased upto as much image size is.
Most of them create a hidden file in storage... And then load their images from their... Some developers also load image only in run-time. Suppose you have a webview behind a Layout. That WebView is only for loading a image. If you set OnClickListener on this Layout then it behaves like a image button. its a silly example :P
The best practice is to use Glide or Picasso to load image from server to your imageview.
https://github.com/bumptech/glide
http://square.github.io/picasso

Decompiling animated GIF file within an app

I would like to download a animated GIF file (more specifically, a weather radar loop), decompile it in frames and play the contents via AnimationDrawable.
The latter part and downloading the image is not a problem, but the middle part is puzzling me: how on earth can I extract the separate frames from the GIF within an app?
I found an easy to use GifDecoder that did the trick for me.

Categories

Resources