由于图像,应用程序尺寸较大。如何压缩 .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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
.png
- 放置在res/drawable
中的文件是 编译应用时自动优化:话虽如此,您还有更多选择可以尝试。 Google I/O 2016 上有一个关于这个主题的精彩演讲,名为“面向 Android 开发者的图像压缩”,其中概述了可能性,解释了它们的优点和缺点,并给出了一些通用的最佳实践。
如果您的应用程序的大小太大而无法在市场上发布,您可以在
.png
-files which are placed in theres/drawable
are automatically optimized when compiling your app: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
使用 pngquant 或 posterizer 来减小 PNG 图像的大小(这些工具是有损的,但可以显着节省)。
您还可以使用 PNGOUT 对其进行优化,这是最好的无损优化器之一。
我已经为这些编写了 Mac GUI。
Use pngquant or posterizer to reduce size of PNG images (these tools are lossy, but give significant savings).
You can also optimize them with PNGOUT, which is one of the best lossless optimizers.
I've written Mac GUI for those.
始终使用 PNG (.png) 图像。
并将图像上传到
https://tinypng.com/
进行在线压缩简单而清醒,始终有效。不客气。 :)
还有一个更好的方法来使用AndEngine,它可以让你不用为每部手机做布局。并且无需为不同 dpi 的手机使用不同的图像。
Always use PNG (.png) images.
And compress it online by uploading your images to
https://tinypng.com/
Simple and sober, always work. You are welcome. :)
There is also a better way to use AndEngine, it saves you from making layout for each phone. And there is no need to use different images for different dpi phones.
您使用 9 块补丁作为背景吗?您还可以使用 imagemagick 或类似的工具来压缩批次或图像。
Do you use 9-patches for backgrounds? Also you can use imagemagick or anything similar to compress a batch or images.