jpegtran
TLDR
Mirror an image horizontally or vertically
SYNOPSIS
jpegtran [options] [file]
DESCRIPTION
jpegtran performs lossless transformations on JPEG images. Unlike re-encoding, these operations work directly on the DCT coefficients, preserving image quality completely.
Supported lossless operations include rotation (in 90-degree increments), flipping, transposition, grayscale conversion, and cropping (on MCU boundaries). The tool can also optimize or convert between baseline and progressive formats.
PARAMETERS
-flip horizontal|vertical
Mirror the image-rotate 90|180|270
Rotate clockwise by specified degrees-transpose
Transpose across main diagonal-transverse
Transpose across anti-diagonal-grayscale
Convert to grayscale-crop WxH+X+Y
Crop to width W, height H, at offset X,Y-outfile FILE
Write output to specified file-optimize
Optimize Huffman tables-progressive
Create progressive JPEG
CAVEATS
Crop dimensions may be adjusted to MCU (Minimum Coded Unit) boundaries. Some transformations may require -trim to discard partial edge blocks. Output goes to stdout by default; redirect or use -outfile.
HISTORY
jpegtran is part of libjpeg/libjpeg-turbo, the reference JPEG library. The original libjpeg was developed by the Independent JPEG Group starting in 1991.


