Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android png optimization

I have an app that using alot of .png fils, so to reduce app size I used PngOptimizer to optimze them. I was happy with the results and the file size of the png's went from alittle over 1mb to 300kb or so. but for some reason the app size only went down about about 100kb. doesn anyone know why? I would really like the file size reduction that I saw in my png files to carry over to my app size. please help

like image 620
John Avatar asked Jul 25 '10 22:07

John


People also ask

How do you optimize photos on Android?

In the Google Photos app, head to settings and select Free up device storage. Keep your photos, but get rid of the space they take up. After you see the calculation for how much space will be opened up, go ahead and select Delete.

Which image format is best for Android?

In android the best format of Image is PNG as it light compare to JPG,JPEG etc.So its easy to draw and take less time to perform the operation while using these images.

What is PNG crunching?

PNG crunching is now a BuildType property and is disabled by default on debug builds. Note: crunching is basically used for png images filter. Follow this answer to receive notifications.


2 Answers

Your .APK application files already get compressed using the deflate algorithm. That is the same algorithm used by PNG files.

So the optimization you've done with the PngOptimizer has already been done to some extend by the .APK packer.

If you want to reduce the size of your application you should either reduce the color-depth of your PNG files (this helps a lot) or switch to .JPG files where possible. These could - depending on what the image contains - be smaller.

like image 132
Nils Pipenbrinck Avatar answered Oct 24 '22 02:10

Nils Pipenbrinck


PNG files in res/drawable are automatically compressed using a palette if possible.

From http://developer.android.com/guide/topics/graphics/2d-graphics.html#drawables :

Note: Image resources placed in res/drawable/ may be automatically optimized with lossless image compression by the aapt tool during the build process. For example, a true-color PNG that does not require more than 256 colors may be converted to an 8-bit PNG with a color palette. This will result in an image of equal quality but which requires less memory.

like image 43
rockeye Avatar answered Oct 24 '22 02:10

rockeye