且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

哪种图像类型的.gif,.jpeg,.bmp,.png最适合asp.net网站

更新时间:2023-11-10 19:47:40

确实取决于您使用它们的目的.例如,JPEG非常适合存储真实物体(例如树木,风景和汽车等)的有损照片. PNG是无损压缩计算机生成图像(例如屏幕截图)的***选择. GIF适用于动画和透明度(PNG支持透明度,但并非在所有浏览器中都适用). BMP很少有用.例如,如果您要构建一些JavaScript函数来修改上传的图像,那么您可能希望使用BMP,因为它是最简单的格式(即,您可以手动检查文件中的字节而没有太多麻烦) .

对于典型的使用案例,JPEG和PNG是主要竞争者,而JPEG是最常见的竞争者.虽然,也有例外.以代码项目为例.大多数文章都包含屏幕截图,当我看到它们都是JPEG压缩格式(如果它们都是PNG时看起来更好并且使用更少的空间)时,我会感到不快.
Really depends on what you use them for. For example, JPEG is good for storing lossy photographs of real life objects (e.g., trees and scenery and cars and so on). PNG is the best option for losslessy compressing computer-generated images (e.g., screenshots). GIF is good for animations and for transparency (PNG supports transparency, but that doesn''t work in all browsers). BMP would only rarely be useful. For example, if you were building some JavaScript function to modify the image as it is uploaded, then you might want to go with BMP, as it is the simplest format (i.e., you could inspect the bytes in the file manually without much trouble).

For typically use cases, JPEG and PNG are the major contenders, with JPEG being the most common. Though, there are exceptions. Take Code Project for example. Most articles contain screenhots and it irks me when I see them JPEG compressed when they would both look better and use less space if they were PNG''s.


最小的图片,大概是jpg .确实是常识.
The smallest ones, so probably jpg. Common sense, really.


如果这是您要查看的性能,那么正如CG所说的,尺寸最小.尽管即使您使用的图像格式不是* .jpg(小尺寸),也不是问题,但是您可以在服务器上启用图像缓存.首次下载后,这将使大小系数无效! (第一次下载需要时间!)
If it''s the performance that you are looking at then as CG told, smallest size one. Though even if you have image in another format than *.jpg (size little higer), not an issue, you can enable the image caching on the server. This would nullify the size factor after first download! (First download would take time!)