manpagez: man pages & more
man opt-jpg(1)
Home | html | info | man
opt-jpg(1)                  General Commands Manual                 opt-jpg(1)


NAME

       opt-jpg - losslessly optimize JPEG image files


SYNOPSIS

       opt-jpg [-h(elp)] [-a(rithmetic)] [-d DCT_arithmetic] [-f filelist]
       [-g(ray)] [-m markers_to_copy] [-M maximum_quality] [-p(ipe)]
       [-q(uiet)] [-r rotation_angle] [-t(ouch)] [-T threads] file...


DESCRIPTION

       opt-jpg losslessly optimizes JPEG images.  This is accomplished using a
       combination of the cpeg, dpeg, imagsize, and jpegtran utilities.


OPTIONS

       -h     Print help and quit.

       -a     Allow arithmetic coding to be used on re-written image files
              instead of the more prevalent Huffman coding.  This can yield
              image files that are 5-7% smaller, but older programs (image
              viewers, web browsers, image editors) might not read them
              successfully.  USE WITH CAUTION.

       -d DCT_arithmetic
              Specify the type of DCT arithmetic to use.  The choices are
              "float" (the default), "int" (less accurate but a little
              faster), and "fast" (not recommended).  See cjpeg(1) for more
              details.  This option only applies when the -M option is used.

       -f file_list
              Read the names of files to be processed from the specified file.

       -g     Force the output to grayscale.  [Note: This operation is not
              lossless.]

       -m markers_to_copy
              Which markers to copy from the source file.  The choices are
              "none" (the default), "comments", "icc", and "all".  See
              jpegtran(1) for more details.  This option is set to "none" when
              the -M option is used.

       -M maximum_quality
              Set the maximum permissible quality value (on the IJG scale,
              between 0 and 100) for the images.  [Note: This operation is not
              lossless.]

       -p     Read the names of files to be processed from stdin.

       -q     Quiet output.  No output commentary will be printed.

       -r rotation_angle
              Rotate the image by 90, 180, or 270 degrees.  Identical to the
              "-rotate" option from jpegtran.  [Note: This operation is not
              always lossless.]

       -t     Preserve timestamp on modified files.

       -T threads
              Process up to the specified number of files in parallel.  The
              default value is half the multi-threading capability of the CPU,
              i.e., half the sibling count as listed in /proc/cpuinfo.


EXAMPLES

       Optimize a couple of image files, forcing a conversion to grayscale:
              opt-jpg g image001.jpg image002.jpg

       Optimize all JPEG images in an directory tree, utilizing half of all
       cores: find . -name "*.jpg" -print | opt-jpg -p

       Fully utilize a quad-core system while optimizing all JPEG images:
              find . -name "*.jpg" -print | opt-jpg -p -T 4


NOTES

       This program may create progressive JPEG files from images that were
       previously non-progressive.  Curiously, they are sometimes smaller.

       The -M and -r options cannot be used simultanously.  If both rotation
       and image quality limits must be imposed, first rotate the images using
       rot-jpg with the -F (fast) option, then recompress with opt-jpg with
       the -M option.

       If opt-jpg appears to be malfunctioning, try running it in single-
       threaded mode using the -T 1 option.  This permits more meaningful
       error messages to be printed.


SEE ALSO

       cjpeg(1), djpeg(1), imagsize, jpegtran(1), rot-jpg(1)


COPYRIGHT

       Copyright (C) 2004-2026 by Brian Lindholm.  This program is free
       software; you can use it, redistribute it, and/or modify it under the
       terms of the GNU General Public License as published by the Free
       Software Foundation; either version 3, 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.

littleutils                       2026 Jan 01                       opt-jpg(1)

littleutils 1.4.0 - Generated Wed Feb 18 07:28:58 CST 2026
© manpagez.com 2000-2026
Individual documents may contain additional copyright information.