决定使用哪种图像格式

发布于 2024-08-05 06:16:43 字数 205 浏览 11 评论 0原文

我正在开发一个网络应用程序,允许用户上传个人资料图片(基本上是头像)。这些图像的大小不会超过 100 x 100 像素,并且是人脸的照片。

我们希望允许用户上传各种图像格式,但我们也希望将它们全部转换为相同的图像格式。就尺寸、质量等而言,最佳的图像格式是什么?

编辑

在这种情况下,尺寸比质量更重要,但相差不大。

I'm working on a web application that will allow users to upload profile pictures (avatars, basically). These images will be no bigger than 100 x 100 pixels and will be pictures of peoples' faces.

We want to allow the user to upload various image formats, but we also want to convert them all to the same image format. What would be the best image format for size, quality, etc.?

Edit

In this case, size is more important than quality, but not by much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

赏烟花じ飞满天 2024-08-12 06:16:43

对于人脸,JPEG 是最好的选择。相对于替代图像,即使是质量相对较高的 JPEG 图像也会被显着压缩。

JPEG 格式(及其压缩工作方式)是为“自然”图像(例如照片)而设计的。 (替代方案,主要是 GIF 和 PNG,更适合计算机图形、图表等。)

话虽如此,您应该尝试一下。拍摄几张示例照片,将它们转换为各种图像格式,然后看看它们如何比较(对主题表示歉意!8-)

JPEG,6,668 字节:

alt text
(来源:entrian.com

PNG,31,651 字节:

< a href="https://i.sstatic.net/R3RCC.png" rel="nofollow noreferrer">替代文本
(来源:entrian.com

For faces, JPEG is your best bet. Even a relatively high quality JPEG image will be significantly compressed relative to the alternatives.

The JPEG format (and the way its compression works) was designed for "natural" images like photographs. (The alternatives, primarily GIF and PNG, work better for computer graphics, diagrams, etc.)

All that said, you should try it. Take a couple of example photos, convert them to the various image formats, and see how they compare (with apologies for the subject matter! 8-)

JPEG, 6,668 bytes:

alt text
(source: entrian.com)

PNG, 31,651 bytes:

alt text
(source: entrian.com)

不知所踪 2024-08-12 06:16:43

我认为 JPG 最适合头像,我找不到透明度的需要。

JPG 对于照片来说还可以,对于图形来说就有点过分了,但是对于 100x100 来说这并不是一个巨大的尺寸开销

I think JPG is best for avatars, I cant find a need for transparency.

JPG will be ok for photographs and will be overdo for graphics, but it's not a huge size overhead for 100x100

尹雨沫 2024-08-12 06:16:43

对于尺寸如此有限的图像,并且考虑到个人资料图片很可能是自然图像,JPEG 无疑是最佳选择。

当处理非常重复的图案时,PNG 效果很好。计算机生成的图形,如屏幕截图、渐变。有几个过滤器可以提高压缩的有效性,但是由于 PNG 的无损性质,您几乎永远不会在此类图像上获得类似的压缩比。

With an image of such limited size, and considering the profile pictures will most likely be a natural image JPEG is most certainly the way to go.

PNG works great when handed a very repetitive pattern. Computer generated graphics like screenshots, gradients. There are a couple of filters that increase the effectiveness of the deflate, however due to the losless nature of PNG, you will almost never get similar compression ratio's on these kinds of images.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文