Linux command
jpegtran 命令
网络
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Mirror
jpegtran -flip [horizontal|vertical] [path/to/image.jpg] > [path/to/output.jpg]
Rotate
jpegtran -rotate [90|180|270] [path/to/image.jpg] > [path/to/output.jpg]
Transpose
jpegtran -transpose [path/to/image.jpg] > [path/to/output.jpg]
Example
jpegtran -grayscale [path/to/image.jpg] > [path/to/output.jpg]
Crop
jpegtran -crop [W]x[H]+[X]+[Y] [path/to/image.jpg] > [path/to/output.jpg]
Example
jpegtran -crop [W]x[H] -outfile [path/to/output.jpg] [path/to/image.jpg]
说明
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.
参数
- -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
FAQ
What is the jpegtran command used for?
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.
How do I run a basic jpegtran example?
Run `jpegtran -flip [horizontal|vertical] [path/to/image.jpg] > [path/to/output.jpg]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -flip _horizontal|vertical_ do in jpegtran?
Mirror the image