LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

jpegtran

performs lossless transformations on JPEG images

TLDR

Mirror an image horizontally or vertically
$ jpegtran -flip [horizontal|vertical] [path/to/image.jpg] > [path/to/output.jpg]
copy
Rotate an image 90, 180, or 270 degrees clockwise
$ jpegtran -rotate [90|180|270] [path/to/image.jpg] > [path/to/output.jpg]
copy
Transpose across upper-left to lower-right axis
$ jpegtran -transpose [path/to/image.jpg] > [path/to/output.jpg]
copy
Convert to grayscale
$ jpegtran -grayscale [path/to/image.jpg] > [path/to/output.jpg]
copy
Crop to specified dimensions
$ jpegtran -crop [W]x[H]+[X]+[Y] [path/to/image.jpg] > [path/to/output.jpg]
copy
Crop and save to specific file
$ jpegtran -crop [W]x[H] -outfile [path/to/output.jpg] [path/to/image.jpg]
copy

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

INSTALL

sudo apt install libjpeg-turbo-progs
copy
sudo dnf install libjpeg-turbo-utils
copy
sudo apk add libjpeg-turbo-utils
copy

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.

SEE ALSO

cjpeg(1), djpeg(1), convert(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid