大尺寸应用,由于影像。如何COM preSS。PNG图像?图像、影像、尺寸、COM

2023-09-08 09:58:41 作者:坐在坟头调戏鬼

我正在开发具有大量的图片上下工夫,由于其我的应用程序的规模已经变得非常大的应用程序。我想COM preSS或类似的东西,以减少应用程序的大小。任何想法?

I am developing an app which has a lot of images to work on due to which the size of my app has become very large. I want to compress or something like that to reduce the size of app. Any idea?

推荐答案

巴纽 -files它被放置在 RES /绘制进行自动优化编译应用程序时:

.png-files which are placed in the res/drawable are automatically optimized when compiling your app:

的位图文件可以自动与无损图像优化  COM $ P $通过在构建过程中AAPT工具pssion。例如,  真彩色的PNG,不需要超过256种颜色可以是  转换成一个8位的PNG有调色板。这将导致  质量相等,但其中的图像需要的内存较少。所以,要小心  这放在这个目录中的图像二进制文件可以在改变  建立。如果你打算在顺序读取图像作为一个比特流  它转换为位图,把你的照片在res /生/文件夹  相反,在那里他们将不被优化。

Bitmap files 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. If you plan on reading an image as a bit stream in order to convert it to a bitmap, put your images in the res/raw/ folder instead, where they will not be optimized. Source

如果您的应用程序的大小是高在市场上发布后,您将需要运输您的应用程序没有图像,并从互联网到手机的SD卡装载它们的时候第一次启动的应用程序。

If the size of your application is to high to be published on the market, you'll need to ship your app without the images and load them from the internet to the phones SD-card when the app is first started.