禁用的Andr​​oid资源/图像/ PNG优化 [英] Disable Android resource / image / png optimization

查看:183
本文介绍了禁用的Andr​​oid资源/图像/ PNG优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何prevent了Android的优化。PNG图像构建过程?

How to prevent the Android "build process" from optimizing .png images?

我的Andr​​oid项目具有以下RES目录:

I have Android project with the following res directories:

 - /res/
 - /res/drawable
 - /res/drawable-hdpi
 - /res/drawable-hdpi-v5
 - /res/drawable-ldpi
 - /res/drawable-ldpi-v5
 - /res/drawable-mdpi
 - /res/drawable-mdpi-v5

这些目录的包含许多.png文件。余优化的PNG尺寸与PNGOUTWin,和整体尺寸减小了20%以上。当我建立的.apk文件,在图像被优化通过构建过程和整体规模,现在10%以上的初始大小或30%以上,我的/ PNGOUTWin优化的大小。

These directories contain many .png files. I optimize PNGs sizes with PNGOUTWin, and overall size is reduced by more than 20%. When I build .apk file, the images are "optimized" by build process and overall size is now 10% above the initial size, or 30% above my/PNGOUTWin optimized size.

我的目标是降低.apk文件的大小,即使它会影响最终的性能,内存的要求等。如何为prevent从优化。PNG图像打造过程?

My goal is to reduce the .apk size, even if it will affect final performance, memory requirements, etc. How to prevent the "build process" from optimizing .png images?

我针对Android 2.2及以上。

I'm targeting Android 2.2 and above.

P.S。目前正在建设我从Eclipse Android项目,但稍后会切换到自动构建(蚂蚁?)

P.S. Currently building my Android project from the Eclipse, but will switch to the automated build later (Ant?)

注意有关JPG图片: JPG将无法工作,因为他们没有透明度

Note about JPG images: JPG will not work because they do not have transparency.

推荐答案

正如前面提到了Android文档中:的 http://developer.android.com/guide/topics/graphics/2d-graphics.html#drawables

As mentioned in the Android documentation : http://developer.android.com/guide/topics/graphics/2d-graphics.html#drawables

注意:放在RES /绘制的图像资源/可与无损图像融为一体pression通过在生成过程中的AAPT工具来自动优化。例如,一个真​​彩色的PNG,不需要超过256种颜色可以用颜色调色板转换成一个8位的PNG。这将导致在同等质量的图像,但它需要较少的存储器。 所以,要知道,放在此目录中的图像二进制文件的可以在生成过程中修改

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. So be aware that the image binaries placed in this directory can change during the build.

所以,如果你想降低您的应用程序的大小,您应该减少颜色深度的PNG文件(这帮助了很多),或者切换到.JPG文件,在可能的情况。

这篇关于禁用的Andr​​oid资源/图像/ PNG优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆