Help us understand the problem. What is going on with this article?

Mozilla 製 JPEG エンコーダー「mozjpeg」

More than 1 year has passed since last update.

Mozilla JPEG Encoder Project

https://github.com/mozilla/mozjpeg/

オンラインツール

https://mozjpeg.codelove.de/
2MB まで。

インストール

CentOS 7.3.1611 へのインストール手順。

curl -LO https://github.com/mozilla/mozjpeg/releases/download/v3.2-pre/mozjpeg-3.2-release-source.tar.gz
tar xf mozjpeg-3.2-release-source.tar.gz
cd mozjpeg
yum install automake gcc nasm
./configure && make && make install

/opt/mozjpeg にインストールされる。

シンボリックリンク

ln -s /opt/mozjpeg/bin/* /usr/local/bin
ln -s /opt/mozjpeg/share/man/man1/* /usr/local/share/man/man1

コマンド名は libjpeg を踏襲しているので、既に libjpeg や libjpeg-turbo がインストールされている場合は注意。

テスト

画像処理界隈で有名な Lena の画像。1

Lena (remastered)

cjpeg -optimize -quality 90 lena.jpg > lena_90.jpg

-quality 未指定の場合のデフォルト値は 75 。
-optimize オプションはファイルサイズを小さくする可能性があるが、メモリの使用量が増え、処理に時間がかかる。画像の品質と圧縮解除速度は影響を受けない。

quality サイズ 時間 圧縮率
84 49451 0.073s 17.5%
90 60599 0.079s 21.5%
95 80572 0.111s 28.6%
100 173504 0.214s 61.5%

コマンド

https://github.com/mozilla/mozjpeg/blob/master/usage.txt
jpegtran がロスレス圧縮で、cjpeg が非可逆圧縮のコマンド。

cjpeg

compress an image file to a JPEG file

cjpeg [ options ] [ filename ]

djpeg

decompress a JPEG file to an image file

djpeg [ options ] [ filename ]

jpegtran

lossless transformation of JPEG files

jpegtran [ options ] [ filename ]

rdjpgcom

display text comments from a JPEG file

rdjpgcom [ -raw ] [ -verbose ] [ filename ]

wrjpgcom

insert text comments into a JPEG file

wrjpgcom [ -replace ] [ -comment text ] [ -cfile name ] [ filename ]
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away