guetzli README

The project's README from github.com/google/guetzli. As one markdown file: README.md.

Guetzli

Introduction

Guetzli is a JPEG encoder that aims for excellent compression density at high visual quality. Guetzli-generated images are typically 20-30% smaller than images of equivalent quality generated by libjpeg. Guetzli generates only sequential (nonprogressive) JPEGs due to faster decompression speeds they offer.

Build Status

Building

On POSIX systems

  1. Get a copy of the source code, either by cloning this repository, or by downloading an archive and unpacking it.
  2. Install libpng. If using your operating system package manager, install development versions of the packages if the distinction exists.
    • On Ubuntu, do apt-get install libpng-dev.
    • On Fedora, do dnf install libpng-devel.
    • On Arch Linux, do pacman -S libpng.
    • On Alpine Linux, do apk add libpng-dev.
  3. Run make and expect the binary to be created in bin/Release/guetzli.

On Windows

  1. Get a copy of the source code, either by cloning this repository, or by downloading an archive and unpacking it.
  2. Install Visual Studio 2015 and vcpkg
  3. Install libpng using vcpkg: .\vcpkg install libpng.
  4. Cause the installed packages to be available system-wide: .\vcpkg integrate install. If you prefer not to do this, refer to vcpkg's documentation.
  5. Open the Visual Studio project enclosed in the repository and build it.

On macOS

To install using Homebrew:

  1. Install Homebrew
  2. brew install guetzli

To install using the repository:

  1. Get a copy of the source code, either by cloning this repository, or by downloading an archive and unpacking it.
  2. Install Homebrew or MacPorts
  3. Install libpng
    • Using Homebrew: brew install libpng.
    • Using MacPorts: port install libpng (You may need to use sudo).
  4. Run the following command to build the binary in bin/Release/guetzli.
    • If you installed using Homebrew simply use make
    • If you installed using MacPorts use CFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' make

With Bazel

There's also a Bazel build configuration provided. If you have Bazel installed, you can also compile Guetzli by running bazel build -c opt //:guetzli.

Using

Note: Guetzli uses a large amount of memory. You should provide 300MB of memory per 1MPix of the input image.

Note: Guetzli uses a significant amount of CPU time. You should count on using about 1 minute of CPU per 1 MPix of input image.

Note: Guetzli assumes that input is in sRGB profile with a gamma of 2.2. Guetzli will ignore any color-profile metadata in the image.

To try out Guetzli you need to build or download the Guetzli binary. The binary reads a PNG or JPEG image and creates an optimized JPEG image:

guetzli [--quality Q] [--verbose] original.png output.jpg
guetzli [--quality Q] [--verbose] original.jpg output.jpg

Note that Guetzli is designed to work on high quality images. You should always prefer providing uncompressed input images (e.g. that haven't been already compressed with any JPEG encoders, including Guetzli). While it will work on other images too, results will be poorer. You can try compressing an enclosed sample high quality image.

You can pass a --quality Q parameter to set quality in units equivalent to libjpeg quality. You can also pass a --verbose flag to see a trace of encoding attempts made.

Please note that JPEG images do not support alpha channel (transparency). If the input is a PNG with an alpha channel, it will be overlaid on black background before encoding.

guetzli (google/guetzli)

Searching Database…

12.9K ·GitHub
archived
这是什么?Guetzli 是谷歌推出的一款感知型 JPEG 编码器,通过优化人眼感知而非单纯的像素指标,在视觉质量相同的情况下,生成的 JPEG 文件比 libjpeg 小 20%–30%。
Guetzli 是命令行工具,还是可以在代码里调用的库?它是一个独立的命令行程序(guetzli),读取 PNG 或 JPEG 文件,并输出经过优化的 JPEG;目前没有文档记载的 API,无法作为库嵌入使用。
我该如何编译和运行它?克隆仓库,安装 libpng,然后运行 `make`(可执行文件位于 bin/Release/guetzli),或者使用 `bazel build -c opt //:guetzli` 通过 Bazel 编译;在 Windows 上需要使用 Visual Studio 2015 配合 vcpkg,在 macOS 上可以直接执行 `brew install guetzli`。
编译之前需要安装哪些东西?需要安装 libpng(根据操作系统,可通过 apt、dnf、pacman、Homebrew、MacPorts 或 vcpkg 安装),以及一个构建工具:类 POSIX 系统使用 make,也可以使用 Bazel;Windows 上则需要 Visual Studio 2015 配合 vcpkg。
批量处理大量图片时速度够快吗?不够快。Guetzli 本身就很吃资源:每百万像素的输入大约需要 300MB 内存,并且大约需要一分钟的 CPU 时间,因此比普通的 JPEG 编码器慢得多,也更占内存。
哪种输入图片效果最好?Guetzli 是为未压缩、高质量的原始图片设计的。它也能接受已经过 JPEG 压缩的图片(包括由 Guetzli 自己压缩过的图片),但效果会明显变差。
它支持带透明度的 PNG 吗?不太支持。JPEG 没有透明通道,因此如果输入带透明度的 PNG,透明区域会在编码前直接叠加到黑色背景上。
我可以控制压缩质量吗?可以。使用 --quality Q 参数,其质量刻度与 libjpeg 相同;加上 --verbose 参数,还可以查看 Guetzli 内部尝试的编码过程记录。
这个项目还在维护吗?不再维护。该仓库在 GitHub 上已被标记为归档,因此现有代码虽然仍能编译和运行,但已不再积极开发或更新。
What are similar projects?TurboBench, brotli, imgproxy, sharp, caire, amazing-qr, ripgrep, watchman
Creator
google
Size
0.5 MB
Stars
12.9K
Age
9y
Commits · 90 Days