ps怎么用jpeg压缩技术_用Guetzli进行JPEG压缩

2023-10-29 13:40

本文主要是介绍ps怎么用jpeg压缩技术_用Guetzli进行JPEG压缩,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

ps怎么用jpeg压缩技术

Web Performance

A little while ago Google released its Guetzli JPEG encoder, which claims a 20-30% improvement in file size over libjpeg. Being intrigued, I decided to give it a go. My tool of choice for optimizing JPEGs has long been jpeg-recompress, one of the binaries available in the jpeg-archive project. It's highly configurable, reasonably fast, and really delivers on optimizing JPEGs. But how does Guetzli compare?

不久前, 谷歌发布了Guetzli JPEG编码器 ,该文件声称文件大小比libjpeg提高了20-30%。 出于好奇,我决定试一试。 长期以来,我选择的用于优化JPEG的工具一直是jpeg-recompress,它是jpeg-archive项目中可用的二进制文件之一。 它是高度可配置的,相当快的,并且确实可以优化JPEG。 但是格茨利如何比较?

基本的测试用例 (A rudimentary test case)

To get started, I used a portrait of myself:

首先,我用自己的画像:

Self portait!

What you see above is a much smaller version of the the unoptimized JPEG source I worked with. The original image is 2560x2561, and weighs in at 861 KB. When I processed this image with Guetzli, I used the following command:

上面看到的是我处理过的未经优化的JPEG源的小得多的版本。 原始图像为2560x2561,大小为861 KB。 当我使用Guetzli处理此图像时,我使用了以下命令:

guetzli unoptimized.jpg guetzli.jpg

This took a while. Quite a while, in fact. This isn't a surprise, though, considering that Google explains in the project readme that you should expect about a minute of CPU time for every megapixel (my test image was 2.5 megapixels). When Guetzli finished, the output file's size was 770 KB. About 11% smaller than the source. Not bad. Them I ran jpeg-recompress on the unoptimized source using this command:

这花了一段时间。 半响 ,其实。 不过,考虑到Google在项目自述文件中解释说,您应该期望每兆像素大约需要一分钟的CPU时间(我的测试图像为2.5兆像素),因此这并不奇怪。 Guetzli完成后,输出文件的大小为770 KB。 比来源小11%。 不错。 我使用以下命令在未优化的源上运行了jpeg-recompress:

jpeg-recompress --accurate --strip unoptimized.jpg guetzli.jpg

jpeg-recompress fared a bit better for me with an output file size of 662 KB, about 23% smaller than the unoptimized source, and 15% smaller than the Guetzli-optimized version. Does this mean that jpeg-recompress is the undisputed winner? It really depends. The way jpeg-recompress works is by iterating over an image within a default quality range of 40 to 95 to find the best compromise between quality and file size. You can specify the amount of loops, but the default (which is usually sufficient) is 6. When optimizing my portrait JPEG, jpeg-recompress landed on a quality of 80. Guetzli's default quality setting is 95. So what happens if I set Guetzli to a comparable setting? Unfortunately, I couldn't. Guetzli doesn't allow you to specify a quality setting less than 84. So to make things a little more comparable to the jpeg-recompress output, I went with the minimally allowed setting of 84:

jpeg-recompress对我来说要好一些,输出文件大小为662 KB ,比未优化的源小23%,比Guetzli优化的版本小15%。 这是否意味着jpeg-recompress是无可争议的赢家? 真的要看 jpeg-recompress的工作方式是对默认质量范围为40到95的图像进行迭代,以找到质量和文件大小之间的最佳折衷方案。 您可以指定循环数,但是默认值(通常足够)是6。优化我的肖像JPEG时,jpeg-recompress的质量为80。Guetzli的默认质量设置为95。因此,如果我设置Guetzli,会发生什么情况到可比的环境? 不幸的是,我不能。 Guetzli不允许您指定小于84的质量设置。因此,为了使事情与jpeg-recompress输出更具可比性,我采用了最小允许设置84:

guetzli --quality 84 unoptimized.jpg guetzli-q84.jpg

The final result? After a (long) wait, the Guetzli-optimized version at a quality setting of 84 was 636 KB. 26 KB smaller than jpeg-recompress at a quality setting of 80. How does Guetzli stack up to the competition when it comes to visual quality? In the case of my portrait image, both optimized versions are nearly indistinguishable.

最终结果? 经过长时间的等待,质量设置为84的Guetzli优化版本为636 KB 。 在质量设置为80时,比jpeg-recompress小26 KB。在视觉质量上,格兹利如何与竞争对手竞争? 就我的肖像图像而言,两个优化版本几乎无法区分。

Optimized image comparisons

Of course, this is just a one-off example. What does Guetzli performance look like across a whole set of images? Let's take a look!

当然,这只是一个例子。 整个图像上的格兹利性能看起来如何? 让我们来看看!

Guetzli在一组图像上的表现 (Guetzli performance across a set of images)

A single test case of a couple image optimizers can be useful, but really only provides a narrow view of performance. If we want to get a broader sense of how well an optimizer works, we should test it across a large set of images. I used several image optimizers on a set of nearly 500 unoptimized images. These images were of various foods. The type of imagery you'd be used to seeing on a recipe website. I used the find command to process the image batch (using the technique I described in this blog post). The unoptimized payload of these images was 37,388 kilobytes. In each case, I aimed for a target quality of 84, the lowest quality allowed by the Guetzli encoder. I also used the time command to get a sense of how long each optimizer takes. Below are the results showing the command used for each optimizer, the time each one took to process the batch of unoptimized images, and the cumulative size of the optimized output:

几个图像优化器的单个测试用例可能会有用,但实际上只能提供性能的狭窄视图。 如果我们想更广泛地了解优化器的工作原理,则应该在大量图像上对其进行测试。 我在一组近500张未优化的图像上使用了几个图像优化器。 这些图像是各种各样的食物。 您习惯在食谱网站上看到的图像类型。 我使用find命令来处理图像批处理(使用我在本博文中描述的技术)。 这些映像的未优化有效负载为37,388千字节。 在每种情况下,我的目标质量都是84,这是Guetzli编码器允许的最低质量。 我还使用了time命令来了解每个优化器需要多长时间。 以下结果显示了用于每个优化器的命令,每个优化器处理一批未优化图像所需的时间以及优化输出的累积大小:

Optimizer CommandTimeSize (KB)
(Unoptimized)n/a37,388
jpegoptim -m84 -s --all-progressive16s16,136
jpeg-recompress -n 84 -x 84 -a -s4m 45s15,320
guetzli --quality 84150m 41s13,636
cjpeg -optimize -quality 84 -progressive38s15,364
优化器命令 时间 大小(KB)
(未优化) 不适用 37,388
jpegoptim -m84 -s --all-progressive 16岁 16,136
jpeg-recompress -n 84 -x 84 -a -s 4m 45s 15,320
guetzli --quality 84 150m 41s 13,636
cjpeg -optimize -quality 84 -progressive 38岁 15,364

Note: The cjpeg binary used is from mozjpeg 3.1

注意:使用的cjpeg二进制文件来自mozjpeg 3.1

Now for the takeaway: Guetzli beats out all of the other optimizers at the lowest allowable quality setting of 84, but it takes a brutal amount of time to do so. While most optimizers will get reasonably close, they can do so several orders of magnitude faster.

现在的外卖:Guetzli击败了所有在84的最低允许质量设置其他优化的,但它需要时间的残酷量这样做。 尽管大多数优化程序会相当接近,但它们可以将速度提高几个数量级。

Moreover, a minimum quality setting of 84 isn't as low as we should be aiming for when it comes to web imagery. We have to treat image quality as a subjective issue, because any number of variables are involved in how the user assess image quality. What about viewing distance, physical device size, or screen resolution? The rules are simple: If you can't tell the difference between an unoptimized image and optimized one, your users won't be able to. If you can tell the difference, that's still no guarantee that your users will be able discern its quality, because they likely won't have a higher version of the same image for reference.

此外,对于网络图像,最低质量设置84并不像我们达到的目标那么低。 我们必须将图像质量视为一个主观问题,因为用户评估图像质量的方式涉及许多变量。 观看距离,物理设备大小或屏幕分辨率如何? 规则很简单:如果无法区分未优化的图像和优化的图像之间的区别,则用户将无法做到。 如果您分辨出差异,那仍然不能保证您的用户能够辨别其质量,因为他们可能不会使用同一图像的更高版本作为参考。

When running jpeg-recompress with a specified quality range of 30-70 across the same set of images, I was able to achieve an output size of 11,114 KB. That's another couple megabytes below the best that Guetzli could do. Even though the output quality was lower, the results were still acceptable (albeit subjectively so).

在同一组图像上以指定的30-70的质量范围运行jpeg-recompress时,我能够实现11,114 KB的输出大小。 这比格兹利所能达到的最佳性能低了几兆字节。 即使输出质量较低,结果仍然可以接受(尽管主观上如此)。

Another thing to consider is that Guetzli cannot encode progressive JPEGs. Progressive JPEGs are usually a smidge smaller than baseline JPEGs. Better yet, because of how progressive JPEGs load, they minimize layout shifting. Less layout shifting means less page re-rendering. Less rendering means less device battery consumed for processing.

要考虑的另一件事是Guetzli无法编码渐进JPEG。 渐进式JPEG通常比基准JPEG小。 更好的是,由于渐进式JPEG的加载方式,它们使布局偏移最小化。 更少的版式移位意味着更少的页面重新呈现。 更少的渲染意味着更少的设备电池消耗。

While Guetzli is highly effective in situations where quality is the paramount concern, I personally prefer other optimizers. While Guetzli handily outdoes the competition at comparable quality settings, it doesn't allow you to optimize images at a setting lower than 84. Because of this limitation, how incredibly CPU-intensive it is, and its lack of progressive JPEG support, I don't feel comfortable recommending it. Don't take my word for it, though. Check out this list of articles about Guetzli and form your own opinions:

尽管Guetzli在质量至上的情况下非常有效,但我个人更喜欢其他优化器。 尽管Guetzli在可比较的质量设置下轻而易举地超过了竞争对手,但它不允许您在低于84的设置下优化图像。由于这一限制,CPU占用率高得令人难以置信,并且缺乏渐进式JPEG支持,推荐它不舒服。 不过,请不要相信我。 查看有关Guetzli的文章列表,并发表自己的见解:

  • Announcing Guetzli: A New Open Source JPEG Encoder

    宣布Guetzli:一种新的开源JPEG编码器

  • Google Releases Guetzli Open Source JPEG Encoder Generating 20 to 35% Smaller Files Compared to Libjpeg

    Google发布Guetzli开源JPEG编码器,与Libjpeg相比,生成的文件小20%至35%

  • Guetzli, Google's New JPEG Encoder

    Google的新型JPEG编码器Guetzli

However you decide to optimize your images, realize that something is always better than nothing. No matter which optimizer you go with, you're doing right by your users, and that's really what matters.

但是,您决定优化图像,要意识到总有总有没有比没有好。 无论使用哪种优化器,用户都在正确地进行操作,这才是真正重要的。

翻译自: https://davidwalsh.name/jpeg-compression-guetzli

ps怎么用jpeg压缩技术


http://www.taodudu.cc/news/show-8088327.html

相关文章:

  • LeetCode236 Lowest Common Ancestor of a Binary Tree
  • PAT甲级 1143 Lowest Common Ancestor (30 分) 建树+暴力查找lca
  • LeetCode 236 -- 二叉树的最近公共祖先 ( Lowest Common Ancestor of a Binary Tree ) ( C语言版 )
  • 杭电acm P2028 Lowest Common Multiple Plus
  • PAT-A1143 Lowest Common Ancestor (30分)
  • hdu 1196 Lowest Bit
  • 26最小公倍数 lowest common multiple
  • PAT甲级1143 Lowest Common Ancestor(JAVA版)
  • PTA甲级 1106 Lowest Price in Supply Chain (25分)
  • 看一个银行信用卡客服,转行测试1年多内从月薪5k到20k的历程
  • 台湾人把信用卡和毒药相提并论,你怎么看?
  • 新规划新理财 信用卡还款小妙招
  • php计算信用卡免息期,信用卡免息期20-50天,怎么计算出来的?
  • POI处理PPTX模板,保持格式不变
  • easyPoi导出表格(模板替换以及注解生成)
  • 二维码解码文字或者链接怎么做?二维码分解内容的方法
  • Unity Zxing做二维码识别出网站带实例
  • 怎么做加密文件二维码?简单技巧快速做二维码
  • 笔记本安装苹果操作系统Leopard
  • 苹果笔记本配件_外媒:苹果若真想环保,应该把 iPhone 12/Pro 换成 USB-C 接口
  • win10水印烦死了_Win10 有水印是盗版吗?教你一眼看穿真伪
  • 如何安装win10
  • win10安装TensorFlow2.0正式版
  • 优秀项目经理的能力模型
  • 在弱矩阵中项目经理该如何系统地做好工作?
  • BSP下生成Public下的usbser代码(使用sysgen_capture命令)
  • CE6 实现 USB 转 串口
  • android usb解析(二)UsbHostManager(and6.0)
  • 苹果手机微信多开实现方法大揭秘
  • 苹果微信多开 微信分身超详细教程
  • 这篇关于ps怎么用jpeg压缩技术_用Guetzli进行JPEG压缩的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



    http://www.chinasem.cn/article/301023

    相关文章

    linux解压缩 xxx.jar文件进行内部操作过程

    《linux解压缩xxx.jar文件进行内部操作过程》:本文主要介绍linux解压缩xxx.jar文件进行内部操作,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、解压文件二、压缩文件总结一、解压文件1、把 xxx.jar 文件放在服务器上,并进入当前目录#

    SpringBoot中如何使用Assert进行断言校验

    《SpringBoot中如何使用Assert进行断言校验》Java提供了内置的assert机制,而Spring框架也提供了更强大的Assert工具类来帮助开发者进行参数校验和状态检查,下... 目录前言一、Java 原生assert简介1.1 使用方式1.2 示例代码1.3 优缺点分析二、Spring Fr

    Linux中压缩、网络传输与系统监控工具的使用完整指南

    《Linux中压缩、网络传输与系统监控工具的使用完整指南》在Linux系统管理中,压缩与传输工具是数据备份和远程协作的桥梁,而系统监控工具则是保障服务器稳定运行的眼睛,下面小编就来和大家详细介绍一下它... 目录引言一、压缩与解压:数据存储与传输的优化核心1. zip/unzip:通用压缩格式的便捷操作2.

    Golang如何对cron进行二次封装实现指定时间执行定时任务

    《Golang如何对cron进行二次封装实现指定时间执行定时任务》:本文主要介绍Golang如何对cron进行二次封装实现指定时间执行定时任务问题,具有很好的参考价值,希望对大家有所帮助,如有错误... 目录背景cron库下载代码示例【1】结构体定义【2】定时任务开启【3】使用示例【4】控制台输出总结背景

    怎么用idea创建一个SpringBoot项目

    《怎么用idea创建一个SpringBoot项目》本文介绍了在IDEA中创建SpringBoot项目的步骤,包括环境准备(JDK1.8+、Maven3.2.5+)、使用SpringInitializr... 目录如何在idea中创建一个SpringBoot项目环境准备1.1打开IDEA,点击New新建一个项

    使用Python进行GRPC和Dubbo协议的高级测试

    《使用Python进行GRPC和Dubbo协议的高级测试》GRPC(GoogleRemoteProcedureCall)是一种高性能、开源的远程过程调用(RPC)框架,Dubbo是一种高性能的分布式服... 目录01 GRPC测试安装gRPC编写.proto文件实现服务02 Dubbo测试1. 安装Dubb

    Qt如何实现文本编辑器光标高亮技术

    《Qt如何实现文本编辑器光标高亮技术》这篇文章主要为大家详细介绍了Qt如何实现文本编辑器光标高亮技术,文中的示例代码讲解详细,具有一定的借鉴价值,有需要的小伙伴可以了解下... 目录实现代码函数作用概述代码详解 + 注释使用 QTextEdit 的高亮技术(重点)总结用到的关键技术点应用场景举例示例优化建议

    qt5cored.dll报错怎么解决? 电脑qt5cored.dll文件丢失修复技巧

    《qt5cored.dll报错怎么解决?电脑qt5cored.dll文件丢失修复技巧》在进行软件安装或运行程序时,有时会遇到由于找不到qt5core.dll,无法继续执行代码,这个问题可能是由于该文... 遇到qt5cored.dll文件错误时,可能会导致基于 Qt 开发的应用程序无法正常运行或启动。这种错

    电脑提示xlstat4.dll丢失怎么修复? xlstat4.dll文件丢失处理办法

    《电脑提示xlstat4.dll丢失怎么修复?xlstat4.dll文件丢失处理办法》长时间使用电脑,大家多少都会遇到类似dll文件丢失的情况,不过,解决这一问题其实并不复杂,下面我们就来看看xls... 在Windows操作系统中,xlstat4.dll是一个重要的动态链接库文件,通常用于支持各种应用程序

    Linux使用scp进行远程目录文件复制的详细步骤和示例

    《Linux使用scp进行远程目录文件复制的详细步骤和示例》在Linux系统中,scp(安全复制协议)是一个使用SSH(安全外壳协议)进行文件和目录安全传输的命令,它允许在远程主机之间复制文件和目录,... 目录1. 什么是scp?2. 语法3. 示例示例 1: 复制本地目录到远程主机示例 2: 复制远程主