JPEGTRAN(1)

NAME
jpegtran - lossless transcoding of JPEG files

SYNOPSIS
jpegtran [ options ] [ filename ]

DESCRIPTION

jpegtran translates JPEG files from one variant of JPEG to another, for example from baseline JPEG to progressive JPEG. The transformation is lossless: no image degradation occurs, which would not be true if you used djpeg followed by cjpeg. However, you cannot alter the image quality, because that would not be a lossless operation. jpegtran reads the named JPEG/JFIF file, or the standard input if no file is named, and produces a JPEG/JFIF file on the standard output.

OPTIONS
jpegtran accepts a subset of the switches recognized by cjpeg. If you specify no switches, you get a plain baseline JPEG output file.

All switch names may be abbreviated; for example, -optimize may be written -opt or -o. Upper and lower case are equivalent. British spellings are also accepted (e.g., -optimise), though for brevity these are not mentioned below.

The basic switches are:

-optimize
    Perform optimization of entropy encoding parameters. Without this, default encoding parameters are used. -optimize usually makes the JPEG file a little smaller, but at the price of slower compression. Note that -progressive implies -optimize.

-progressive
    Create progressive JPEG file (see below).

The -progressive switch creates a "progressive JPEG" file. In this type of JPEG file, the data is stored in multiple scans of increasing quality. If the file is being transmitted over a slow communications link, the decoder can use the first scan to display a low-quality image very quickly, and can then improve the display with each subsequent scan. The final image is exactly equivalent to a standard JPEG file of the same quality setting, and the total file size is about the same --- often a little smaller. Caution: progressive JPEG is not yet widely implemented, so many decoders will be unable to view a progressive JPEG file at all.

Switches for advanced users:

-restart N
    Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is attached to the number. -restart 0 (the default) means no restart markers.

-maxmemory N
    Set limit for amount of memory to use in processing large images. Value is in thousands of bytes, or millions of bytes if "M" is attached to the number. For example, -max 4m selects 4000000 bytes. If more space is needed, temporary files will be used.

-outfile name
    Send output image to the named file, not to standard output.

-verbose
    Enable debug printout. More -v's give more output. Also, version information is printed at startup.

-debug
    Same as -verbose.

The -restart option inserts extra markers that allow a JPEG decoder to resynchronize after a transmission error. Without restart markers, any damage to a compressed file will usually ruin the image from the point of the error to the end of the image; with restart markers, the damage is usually confined to the portion of the image up to the next restart marker. Of course, the restart markers occupy extra space. We recommend -restart 1 for images that will be transmitted across unreliable networks such as Usenet.

Switches for wizards:

-scans file
    Use the scan script given in the specified text file.

The "wizard" switches are intended for experimentation with JPEG. If you don't know what you are doing, don't use them. These switches are documented further in the file wizard.doc.

EXAMPLES

This example converts a baseline JPEG file to progressive form:

    jpegtran -progressive foo.jpg > fooprog.jpg

ENVIRONMENT

JPEGMEM
    If this environment variable is set, its value is the default memory limit. The value is specified as described for the -maxmemory switch. JPEGMEM overrides the default value specified when the program was compiled, and itself is overridden by an explicit -maxmemory.

SEE ALSO
cjpeg(1), djpeg(1), rdjpgcom(1), wrjpgcom(1)
Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.

AUTHOR
Independent JPEG Group

BUGS
Arithmetic coding is not supported for legal reasons.

Still not as fast as we'd like.