The demerits of AAPT lies in the above three points. If it is less than or equal to 256, then it decreases the size of image. It finds the total number of colors used in the image. If your image is opaque then it will remove that channel and as a result of that, your image size will be reduced. It checks if the image is having some transparency channel or the image is opaque. greyscale or the image is having combination of different colors It analyses the PNG file to check if the image is having only white and black color i.e. So, lets first learn what AAPT does for us: In Android, the AAPT tool does the above thing on PNG images for us. But if the image is having a number of color combinations then compression is difficult. To summarize the above two process, we can say that if the image is having lesser color combinations then more compression can be done because the pixel difference will be around 0. The output of the deflate is then sent to the disk. The output of this LZ77 is then fed into the Huffman encoder which is almost identical to compressors like PKWARE, GZip, etc. LZ77 is a dictionary algorithm that finds the duplicate characters multiple times in a stream of data. The output of the filtering process is put into an encoding system called For example, if an image contains only red color then the compression will be easier because only one color is there. Less the difference, similar will be the color and larger will be the compression. So, the main idea is to get the minimum difference possible. Here in this process, we will keep the value at each pixel and find the difference of value at one pixel with the value of the next or previous or up or down of a pixel. The whole PNG compression process can be divided into two processes: Each row of pixels in a PNG image is taken and processed one at a time. you can get back your original image from the compressed one i.e. But due to this, we need to apply some image compression techniques also. They provide a nice and high-resolution image format. PNG or Portable Network Graphics is the most commonly used image file in Android these days. Let's have a look at these image formats and how it works internally. In Android, we generally deal with the below four image types: So, it is always very important to make sure that the images used in your application are compressed to give a better experience to your users. Not only that it will take more data to download the image and also it will drain the battery. For example, if your app is loading an image of 5MB over a 2G network, and it is taking time, then you might end up losing one user of your application. Images can be too big or can have too many pixels or resolutions and this, in turn, reduce your application's performance. We can convey the information through images in a much much better way as compared to texts.īut the problem with images is that images can be easily bloated. Images are the best way to convey our message to our users. We will be covering the below points in this blog: Today, we will understand image compression so that in future if you are planning to use some images in your app then you can just follow this blog and use the most suitable image format to reduce the APK size. So, if we reduce the size of the images used in the application then eventually the APK size will be reduced. You might have noticed that the applications dealing with images(either the local image or downloaded from the internet) are bigger in size and also we know that lesser the application size more the number of downloads. It helps in conveying our message in a better way. Images play an important role in any application.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |