First of all, don't forget to install the JPEG manipulating programs package:
# apt-get install libjpeg-progs
$ jpegtran -copy none -progressive input.jpg > output.jpg
- yes, it produces a progressive JPEG output image; if you don't like it (or it's unsupported in the target environment), use
-optimize
switch instead of-progressive
(but the output image size will be bigger); - there's also a non-recommended option (an
-arithmetic
switch) to enable arithmetic coding; it allows a more efficient compression than traditional Huffman coding does, but (unfortunately) it's not widely supported in JPEG decoders due to some historical patent restrictions; -copy none
option removes all extra markers (comments, tags, thumbnails and other metadata) from the output; if you need to save them, use-copy comments
(or even-copy all
) option instead;- you can add a
-grayscale
option, and it will omit color data from the output image without re-encoding (very useful for grayscale / black & white / monochrome images); - more reading:
jpegtran -help
andman jpegtran
- JPEG - Wikipedia
- libjpeg - Wikipedia
No comments:
Post a Comment