JPEGOPTIM(1)
π JPEGOPTIM π
okay bestie, gather round, because we're talking about jpegoptim β the utility to optimize/compress JPEG/JFIF files, and honestly? she's that girl. this is her manual page, and yes, it's JPEGOPTIM(1) from the General Commands Manual, but we're doing this my way now. π
β¨ SYNOPSIS β¨
jpegoptim [ options ] [ filenames ]
that's it. that's the whole vibe. options, then files. periodt. π
πΈ DESCRIPTION πΈ
so jpegoptim is literally used to optimize/compress jpeg files. and she does it two ways, okay:
- lossless optimization β this one's based on optimizing the Huffman tables. no quality lost, we love a sustainable queen.
- "lossy" optimization β and here, on top of optimizing the Huffman tables, you the user can also specify an upperlimit for image quality. so it's lossless plus a little ~glow down~ if you want.
NOTE! By defaultjpegoptimmodifies the input files (if they are optimized). so like, she's not a copy girlie, she's an in-place girlie. to preserve original files, use option-dto specify an alternate directory for saving the optimized files to. π«Ά
Only normal files are optimized β symbolic links and special files are skipped. Also, any other hard links to the file being optimized (as created using link(2)) are unaffected. like, they don't get the memo. they stay exactly how they were. π
π OPTIONS π
Options may be either the traditional POSIX one letter options, or the GNU style long options. POSIX style options start with a single -, while GNU long options start with --. pick your fighter, both slay.
Options offered by jpegoptim are the following:
-d<path>,--dest=<path>β Sets alternative destination directory where to save optimized files (default is to overwrite the originals). Please note that unchanged files won't be added to the destination directory. This means if the source file can't be compressed, no file will be created in the destination path. so if she can't improve it, she's not even gonna show up. iconic behaviour honestly.-f,--forceβ Force optimization, even if the result would be larger than the original file. yes bestie, larger. she said "i'm optimizing regardless of the consequences."-h,--helpβ Displays short usage information and exits. the "just tell me what to do" button. π¦-m<quality>,--max=<quality>β Sets the maximum image quality factor (disables lossless optimization mode, which is by default enabled). This option will reduce quality of those source files that were saved using higher quality setting. While files that already have lower quality setting will be compressed using the lossless optimization method.
Valid values for quality parameter are: 0 - 100
-n,--noactionβ Don't really optimize files, just print results. window shopping mode. looking respectfully. π-S<size>,--size=<size>β Try to optimize file to given size (disables lossless optimization mode). Target size is specified either in kilobytes (1-n) or as percentage (1%-99%) of the original file size.-T<threshold>,--threshold=<threshold>β Keep the file unchanged if the compression gain is lower than the threshold (%).
Valid values for threshold are: 0 - 100
-w<max>,--workers=<max>β Set the maximum number of parallel processes to launch. (Default is1) multi-tasking era fr fr. β-b,--csvβ Print progress info in CSV format. for the spreadsheet besties. π-o,--overwriteβ Overwrite target file even if it exists (when using-doption).-p,--preserveβ Preserve file modification times. respect the timeline. π°οΈ-P,--preserve-permsβ Preserve file permissions (owner/group) by overwriting the original file. This is slightly less safe than the default mode of operation (where new file is first saved as temporary file and then renamed over the original file). In this mode a backup of the original file is made with.jpegoptim.bakextension, and this file is removed after the original file has been successfully replaced.
NOTE! if runningjpegoptimas root there is generally no need to use this option, asjpegoptimis able to preserve file permissions when run by root in default mode. so root besties, you're already covered. π«Ά
-q,--quietβ Quiet mode. she's not talking. she's just working. π-r,--retryβ Recursively re-try compression until output file size does not get smaller anymore. This can result a few bytes smaller output file, but with the expense of lot more computing time used.
NOTE! This option is on only effective when used in compbination with-m(--max) or-S(--size) option.
(yes, "comb*ination*" β we're keeping that exactly as written, she said what she said π)
-t,--totalsβ Print totals after processing all files. the receipts. π§Ύ-v,--verboseβ Enables verbose mode (positively chatty). she's yapping and we're listening. π--auto-modeβ Select progressive vs non-progressive mode based on which one produces smaller output file. By default mode (progressive vs non-progressive) is preserved.--all-normalβ Force all output files to be non-progressive. Can be used to convert all input files to non-progressive JPEGs when used with--forceoption.--all-progressiveβ Force all output files to be progressive. Can be used to convert all normal (non-progressive) JPEGs input files to progressive when used with--forceoption.--all-arithβ Force all output files to use Arithmetic Coding. This option is experimental and only available ifjpegoptimwas compiled with Arithmetic Coding support enabled. experimental, so handle with care bestie.--all-huffmanβ Force all output files to use (traditional) Huffman coding. This option is experimental and only available ifjpegoptimwas compiled with Arithmetic Coding support enabled.--nofixβ Skip processing of any input files that have any errors/warnings during decompression. By defaultjpegoptimwill attempt to optimize any file that it is able to decompress, even if decompression generates warnings. This will 'fix' some (corrupt) JPEG images automatically. If this behaviour is not desired, this option can be used to makejpegoptimto skip any input files that contain any errors.--save-extraβ Save extraneous data after end of the JPEG image in the input file (default is to discard any extraneous data after the end of image that may be present). This may be useful if JPEG image contains non-standard extensions that are not part of the JPEG image format.
NOTE! This option does not work if input JPEG image is read from standard input (stdin).
--stdoutβ Send output image to standard output. Note, if optimization didn't create smaller file than the input file, then no output original image is passed through unmodified (except any extra data after JPEG image will be discarded).--stdinβ Read input image from standard input and send output to standard output (--stdoutis assumed when this option is used). When this option is used then only one image is read from standard input. Any (other) input files specified on command-line are ignored. Note, if input file-is seen on command line then standard input is also assumed.--files-stdinβ Read names of files to process from standard input. One filename per line.--files-from=<filename>β Read names of files to process from a file. One filename per line.
π METADATA OPTIONS π
By default jpegoptim will keep common metadata (JPEG markers) and discard any other (unknown ones). she has a guest list and it's short. π
Following markers are kept by default:
- EXIF
- IPTC
- ICC
- XMP
- COM (JPEG Comment markers)
JFIF marker will be regenerated (by libjpeg) during the process (this cannot be changed). However, Adobe marker is also generated (or omitted) by libjpeg based on the image colorspace, etc. This behavior depends on libjpeg library version being used. To make sure Adobe marker is preserved option --keep-adobe can be used.
To remove additional markers one or more the --strip-* options can be used.
For example:
--strip-icc --strip-xmp --strip-com
Alternatively it is possible to specify --strip-all and then one or more of the --keep-* options to explicitly list which markers to keep.
For example:
--strip-all --keep-exif --keep-iptc
Options for controlling metadata (markers) in output files:
-s,--strip-allβ Strip all markers from output file.
NOTE! by default only Comment & Exif/IPTC/PhotoShop/ICC/XMP markers are kept, everything else is discarded. Output JPEG still likely will contains one or two markers (JFIF and Adobe APP14) depending on colorspace used in the image, as these markers are generated by the libjpeg encoder automatically.
--strip-none,--keep-allβ Preserve "all" markers in the image. This will leave all markers untouched in the image, except JFIF (APP0) and Adobe (APP14) markers as those get regenerated by thelibjpeglibrary.
NOTE! If this option is specified then any other--strip-*or--keep-*options are ignored. she's not hearing any other opinions. π
--strip-comβ Strip Comment (COM) markers from output file.--strip-exifβ Strip EXIF markers from output file.--strip-iptcβ Strip IPTC / Adobe Photoshop (APP13) markers from output file.--strip-iccβ Strip ICC profiles from output file.--strip-xmpβ Strip XMP profiles from output file.--strip-jfifβ Strip JFIF markers from output file.--strip-jfxxβ Strip JFXX (JFIF Extensions) markers from output file.--strip-adobeβ Strip Adobe markers from output file.--keep-comβ Do not strip any Comment (COM) markers from output file.--keep-exifβ Do not strip any EXIF markers from output file.--keep-iptcβ Do not strip any IPTC / Adobe Photoshop (APP13) markers from output file.--keep-iccβ Do not strip any ICC profiles from output file.--keep-xmpβ Do not strip any XMP profiles from output file.--keep-jfifβ Do not strip any JFIF markers from output file.--keep-jfxxβ Do not strip any JFXX (JFIF Extensions) markers from output file.--keep-adobeβ Do not strip Adobe markers from output file.
π BUGS π
When using --size option, resulting file is not always exactly the requested size. not exact, bestie, she's doing her best. Workaround is to re-run jpegoptim on the same file again which often will result file closer to target size. so like, run it twice. manifesting the right file size. β¨
π SEE ALSO π
jpeginfo(1) β her bestie. go say hi. π«Ά
π AUTHOR π
Timo Kokkonen <tjko@iki.fi> β the actual legend who made all of this happen. bow down. π
π COPYING π
Copyright (C) 1996-2025 Timo Kokkonen
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
and that's the whole page bestie!! π this one came from the 4th Berkeley Distribution, dated 28 Jan 2025, and it's JPEGOPTIM(1) β go compress something and think of me. mwah. πβ¨π¦π
π¦ where this page comes from
- alpine 3.24: jpegoptim-doc 1.5.6-r0 Β· GPL-2.0-or-later
- arch rolling: jpegoptim 1.5.6-1 Β· GPL-2.0-or-later
- epel 10: jpegoptim 1.5.6-1.el10_2 Β· GPL-3.0-or-later
- fedora 43: jpegoptim 1.5.6-1.fc43 Β· GPL-3.0-or-later
- fedora 44: jpegoptim 1.5.6-2.fc44 Β· GPL-3.0-or-later
- nixos 26.05: jpegoptim 1.5.6
- nixpkgs unstable: jpegoptim 1.5.6
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms