ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

PNG vs JPG,用于在Android应用程序中显示图片(而非图标)

2019-11-22 21:28:02  阅读:292  来源: 互联网

标签:android-imageview android-image android


在开始我的问题之前,请先让我说清楚,对于图标等,png是Android中的首选格式.

>我的问题是在显示大图像(图片或照片)时,首选格式是什么?我正在尝试查看是否可以使用jpg图像,因为它们的尺寸较小.
>我还要查看将jpg图像用于这些大图片是否会引起使用png图像可以避免的任何问题.就我而言,我是在谈论普通的不透明图像. [没有Alpha /透明度]

在大多数情况下,我的图像会填满整个屏幕,在某些情况下,我会在网格中使用较小的图像缩略图版本.图片库是我尝试构建的最接近的库.

我看到了另一个有关png vs jpg的问题,但我想从Android的角度而不是任何其他用例中获得一些见识.

解决方法:

This question应该对此有所启示.很有帮助.大多数与PNG一起使用的主要原因是alpha透明性问题.如果这不适用于您,则可能与您的联系不那么紧密.

而且,this article的深度更深.

PNG is a newer format, and is really a good replacement for GIFs. Sadly, however, it has a few drawbacks: Firstly it cannot support animation like GIF can. Secondly it has some support issues with older browsers like IE6. Thirdly, important software like Photoshop have very poor implementation of the format.
Here’s what’s good about it: Unlike GIFs, PNGs can either be Indexed or Direct color (like JPGs), if need be. That means that it can have nice smooth gradients, if you don’t mind a larger file. PNG also supports a nifty thing called Alpha Transparency which means that you have things like smooth drop shadows, even on Indexed color images. Most of the time, an Indexed color PNG filesize will be smaller or equal to a GIF equivalent. Using the extra features (thousands of colours or alpha transparency) will increase the filesize, though.
Essentially using PNG just gives you greater options and flexibility.

标签:android-imageview,android-image,android
来源: https://codeday.me/bug/20191122/2062519.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有