由于图片,应用程式大小较大。如何压缩.PNG图像? [英] Large app size due to images. How to compress .PNG images?

查看:289
本文介绍了由于图片,应用程式大小较大。如何压缩.PNG图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发的应用程序有很多的图像工作,由于我的应用程序的大小已变得非常大。我想压缩或类似的东西,以减少应用程序的大小。任何想法?

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?

推荐答案

.png res / drawable 自动优化


位图文件可能会自动优化无损图像$ b 。例如,不需要超过256种颜色的
真彩色PNG可能是
转换为8位PNG一个调色板。这将产生质量相等的
图像,但是需要更少的内存。因此,请注意
,这个目录中放置的图像二进制文件可以在
构建期间更改。如果你计划将图像作为位流读取,以便将
转换为位图,请将图像放在res / raw /文件夹
中,而不进行优化。

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.

话虽如此,你还有更多的选择。有关此主题的一个很好的讨论,来自Google I / O 2016,名为Android开发者的图像压缩

That being said, you have some more options to try. There is a good talk on this topic from Google I/O 2016 called "Image Compression for Android Developers", which outlines the possibilities, explains their up and downsides and gives some general best practices.

如果您的应用程序的大小为高可在市场上发布,您可以

If the size of your application is to high to be published on the market, you'll can either


  • 发送您的应用程序,无需图像,并将它们从互联网加载到手机应用程式启动时的SD卡

  • 使用Android自己的 APK Extension Files ,这基本上是一样的,但你不必自己做一切。

  • ship your app without the images and load them from the internet to the phones SD-card when the app is first started
  • Use Androids own APK Extension Files, which is basically the same but you don't have to do everything yourself.

这篇关于由于图片,应用程式大小较大。如何压缩.PNG图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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