10139N/A<!
DOCTYPE REFENTRY PUBLIC "-//Sun Microsystems//DTD DocBook V3.0-Based SolBook Subset V2.0//EN" [
10139N/A<!--ArborText, Inc., 1988-1999, v.4002-->
10139N/A<!
ENTITY suncopy "Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.">
10139N/A<
refmeta><
refentrytitle>jpegtran</
refentrytitle><
manvolnum>1</
manvolnum>
10139N/A<
refmiscinfo class="date">26 Mar 2004</
refmiscinfo>
10139N/A<
refmiscinfo class="sectdesc">&man1;</
refmiscinfo>
10139N/A<
refmiscinfo class="software">&release;</
refmiscinfo>
10139N/A<
refmiscinfo class="arch">generic</
refmiscinfo>
10139N/A<
refmiscinfo class="copyright">&suncopy;</
refmiscinfo>
10139N/A<
indexterm><
primary>jpegtran</
primary></
indexterm><
indexterm><
primary>lossless
10139N/Atransformation of JPEG files</
primary></
indexterm>
10139N/A<
refnamediv id="jpegtran-1-name"><
refname>jpegtran</
refname><
refpurpose>lossless
10139N/Atransformation of JPEG files</
refpurpose></
refnamediv>
10139N/A<
refsynopsisdiv id="jpegtran-1-synp"><
title>&synp-tt;</
title>
10139N/A<
cmdsynopsis><
command>&cmd;</
command><
arg choice="opt"><
option role="nodash"><
replaceable>
10139N/Aoptions</
replaceable></
option></
arg><
arg choice="opt"><
option role="nodash"><
replaceable>
10139N/Afilename</
replaceable></
option></
arg>
10139N/A<
refsect1 id="jpegtran-1-desc"><
title>&desc-tt;</
title>
10139N/A<
para><
command>&cmd;</
command> performs various useful transformations of
10139N/AJPEG files. <
command>&cmd;</
command> can translate the coded representation
10139N/Afrom one variant of JPEG to another, for example from baseline JPEG to progressive
10139N/AJPEG or vice versa. <
command>&cmd;</
command> can also perform some rearrangements
10139N/Aof the image data, for example turning an image from landscape to portrait
10139N/A<
para><
command>&cmd;</
command> works by rearranging the compressed data (DCT
10139N/Acoefficients), without ever fully decoding the image. Therefore, <
command>&cmd;</
command>
10139N/Atransformations are lossless: there is no image degradation at all, which
10139N/Awould not be true if you used <
command>djpeg</
command> followed by <
command>
10139N/Acjpeg</
command> to accomplish the same conversion. However, <
command>&cmd;</
command>
10139N/Acannot perform lossy operations such as changing the image quality.</
para>
10139N/A<
para><
command>&cmd;</
command> reads the named
JPEG/
JFIF file, or the standard
10139N/Ainput if no file is named, and produces a
JPEG/
JFIF file on the standard output.
10139N/A<
refsect1 id="jpegtran-1-opts"><
title>&opts-tt;</
title>
10139N/A<
para>All options may be abbreviated. For example, <
option>optimize</
option>
10139N/Amay be written <
option>opt</
option> or <
option>o</
option>. Upper and lower
10139N/Acase are equivalent. British spellings are also accepted. For example, <
option>
10139N/A<
para>The following options are supported:</
para>
10139N/A<
variablelist termlength="medium">
10139N/A<
varlistentry><
term><
option>copy all</
option></
term><
listitem><
para>Copy all
10139N/Aextra markers. This option preserves miscellaneous markers found in the source
10139N/Afile, such as JFIF thumbnails and source-application settings. In some files,
10139N/Athese extra markers can be sizable.</
para>
10139N/A<
varlistentry><
term><
option>copy comments</
option></
term><
listitem><
para>
10139N/ACopy only comment markers. This option copies comments from the source file,
10139N/Abut discards any other inessential data. This is the default.</
para>
10139N/A<
varlistentry><
term><
option>copy none</
option></
term><
listitem><
para>Copy
10139N/Ano extra markers from the source file. This option suppresses all comments
10139N/Aand other excess information present in the source file.</
para>
10139N/A<
varlistentry><
term><
option>flip horizontal</
option></
term><
listitem><
para>
10139N/ACreate a mirror image horizontally, that is, from left to right. This is a
10139N/A<
varlistentry><
term><
option>flip vertical</
option></
term><
listitem><
para>
10139N/ACreate a mirror image vertically, that is, from top to bottom. This is a lossless
10139N/A<
varlistentry><
term><
option>grayscale</
option></
term><
listitem><
para>Force
10139N/Agrayscale output. This is not a lossless transformation. For more information
10139N/Aabout the <
option>grayscale</
option> option, see the Extended Description
10139N/A<
varlistentry><
term><
option>maxmemory <
replaceable>N</
replaceable></
option></
term>
10139N/A<
listitem><
para>Set the limit for the amount of memory to use in processing
10139N/Alarge images. <
replaceable>N</
replaceable> is specified in thousands of bytes,
10139N/Aor in millions of bytes if "M" is specified with the number. For example, <
option>
10139N/Amax 4m</
option> selects 4000000 bytes. If more space is needed, temporary
10139N/A<
varlistentry><
term><
option>optimize</
option></
term><
listitem><
para>Optimize
10139N/Athe entropy encoding parameters. For more information about the <
option>optimize
10139N/A</
option> option, see <
citerefentry><
refentrytitle>cjpeg</
refentrytitle><
manvolnum>
10139N/A1</
manvolnum></
citerefentry>.</
para>
10139N/A<
varlistentry><
term><
option>outfile <
replaceable>name</
replaceable></
option></
term>
10139N/A<
listitem><
para>Send the output image to the named file, instead of to the
10139N/A<
varlistentry><
term><
option>progressive</
option></
term><
listitem><
para>Create
10139N/Aa progressive JPEG file. For more information about the <
option>progressive
10139N/A</
option> option, see <
citerefentry><
refentrytitle>cjpeg</
refentrytitle><
manvolnum>
10139N/A1</
manvolnum></
citerefentry>.</
para>
10139N/A<
varlistentry><
term><
option>restart <
replaceable>N</
replaceable></
option></
term>
10139N/A<
listitem><
para>Emit a JPEG restart marker every <
replaceable>N</
replaceable>
10139N/AMCU rows, or every <
replaceable>N</
replaceable> MCU blocks if "B" is specified
10139N/Awith the number. For more information about the <
option>restart</
option> option,
10139N/Asee <
citerefentry><
refentrytitle>cjpeg</
refentrytitle><
manvolnum>1</
manvolnum>
10139N/A<
varlistentry><
term><
option>rotate 90</
option></
term><
listitem><
para>Rotate
10139N/Athe image 90 degrees clockwise. This is a lossless transformation.</
para>
10139N/A<
varlistentry><
term><
option>rotate 180</
option></
term><
listitem><
para>Rotate
10139N/Athe image 180 degrees clockwise. This is a lossless transformation.</
para>
10139N/A<
varlistentry><
term><
option>rotate 270</
option></
term><
listitem><
para>Rotate
10139N/Athe image 270 degrees clockwise, or 90 degrees anticlockwise. This is a lossless
10139N/A<
varlistentry><
term><
option>scans <
replaceable>file</
replaceable></
option></
term>
10139N/A<
listitem><
para>Use the scan script provided in the specified text file.</
para>
10139N/A<
varlistentry><
term><
option>transpose</
option></
term><
listitem><
para>Transpose
10139N/Athe image, that is, across the UL-to-LR axis. This is a lossless transformation.
10139N/AFor more information about the <
option>transpose</
option> option, see the
10139N/AExtended Description section.</
para>
10139N/A<
varlistentry><
term><
option>transverse</
option></
term><
listitem><
para>Transverse
10139N/Atranspose the image, that is, across the UR-to-LL axis. This is a lossless
10139N/A<
varlistentry><
term><
option>trim</
option></
term><
listitem><
para>Drop non-transformable
10139N/Aedge blocks. This is not a lossless transformation. For more information about
10139N/Athe <
option>trim</
option> option, see the Extended Description section.</
para>
10139N/A<
varlistentry><
term><
option>verbose</
option></
term><
listitem><
para>Display
10139N/Aversion information at startup, and enable debug printout. The <
option>vv
10139N/A</
option> option displays more verbose output than the <
option>v</
option>
10139N/Aoption. The <
option>vvv</
option> option displays the most verbose output.
10139N/A<
para>You can also use <
option>debug</
option> to specify this option.</
para>
10139N/A<
refsect1 id="jpegtran-1-oper"><
title>&oper-tt;</
title>
10139N/A<
para>The following operands are supported:</
para>
10139N/A<
variablelist termlength="medium">
10139N/A<
varlistentry><
term><
option role="nodash"><
replaceable>filename</
replaceable></
option></
term>
10139N/A<
listitem><
para>The name of the JPEG file to be transformed.</
para>
10139N/A<
refsect1 id="jpegtran-1-exde"><
title>&exde-tt;</
title>
10139N/A<
para>If you do not specify one of the following options, you get a plain
10139N/Abaseline-JPEG output file: <
option>optimize</
option>, <
option>progressive
10139N/A</
option>, <
option>restart <
replaceable>N</
replaceable></
option>, <
option>
10139N/Ascans <
replaceable>file</
replaceable></
option>. In such cases, the quality
10139N/Asetting and other settings are determined by the input file.</
para>
10139N/A<
refsect2 id="jpegtran-1-exde-lossless">
10139N/A<
title>Lossless Transformations</
title>
10139N/A<
para>The transpose transformation has no restrictions as regards image dimensions.
10139N/AThe other transformations operate rather oddly if the image dimensions are
10139N/Anot a multiple of the iMCU siz, usually 8 or 16 pixels, because they can only
10139N/Atransform complete blocks of DCT coefficient data in the desired way. The
10139N/Adefault behavior when transforming an odd-size image is designed to preserve
10139N/Aexact reversibility and mathematical consistency of the transformation set.
10139N/A<
para>As stated, transpose can flip the entire image area. Horizontal mirroring
10139N/Aleaves any partial iMCU column at the right edge untouched, but is able to
10139N/Aflip all rows of the image. Similarly, vertical mirroring leaves any partial
10139N/AiMCU row at the bottom edge untouched, but is able to flip all columns.</
para>
10139N/A<
para>The other transforms can be built up as sequences of transpose and flip
10139N/Aoperations. For consistency, their actions on edge pixels are defined to be
10139N/Athe same as the end result of the corresponding transpose-and-flip sequence.
10139N/A<
refsect2 id="jpegtran-1-exde-notlossless">
10139N/A<
title>Not-Lossless Transformations</
title>
10139N/A<
para>You may prefer to discard any untransformable edge pixels rather than
10139N/Ahave a strange-looking strip along the right or bottom edges of a transformed
10139N/Aimage. To do this, use the <
option>trim</
option> option. Obviously, a transformation
10139N/Awith <
option>trim</
option> is not reversible, so strictly speaking <
command>&cmd;</
command>
10139N/Awith this option is not lossless. Also, the expected mathematical equivalences
10139N/Abetween the transformations no longer hold. For example, <
option>rot 270</
option> <
option>
10139N/Atrim</
option> trims only the bottom edge, but <
option>rot 90</
option> <
option>
10139N/Atrim</
option> followed by <
option>rot 180</
option> <
option>trim</
option> trims
10139N/A<
para>Another not-strictly-lossless transformation option is <
option>grayscale
10139N/A</
option>. This option discards the chrominance channels if the input image
10139N/Ais YCbCr (that is, a standard color JPEG), which results in a grayscale JPEG
10139N/Afile. The luminance channel is preserved exactly, so this is a better method
10139N/Aof reducing to grayscale than decompression, conversion, and recompression.
10139N/AThe <
option>grayscale</
option> option is particularly useful for fixing a
10139N/Amonochrome picture that was mistakenly encoded as a color JPEG. In such a
10139N/Acase, the space saved by discarding the near-empty chrominance channels is
10139N/Anot large, but the decoding time for a grayscale JPEG is substantially less
10139N/Athan that for a color JPEG.</
para>
10139N/A<
refsect1 id="jpegtran-1-exam"><
title>&exam-tt;</
title>
10139N/A<
title>Converting a Baseline JPEG File to Progressive Form</
title>
10139N/A<
title>Rotating an Image 90 Degrees Clockwise, Discarding Any Unrotatable
10139N/A<
refsect1 id="jpegtran-1-envr"><
title>&envr-tt;</
title>
10139N/A<
para><
command>&cmd;</
command> uses the following environment variables:</
para>
10139N/A<
varlistentry><
term>JPEGMEM</
term><
listitem><
para>The value of this environment
10139N/Avariable, if set, is the default memory limit. The value is specified as described
10139N/Afor the <
option>maxmemory</
option> option. JPEGMEM overrides the default value
10139N/Aspecified when the program was compiled, and is in turn overridden by an explicit <
option>
10139N/Amaxmemory</
option> option.</
para>
10139N/A<
refsect1 id="jpegtran-1-attr"><
title>&attr-tt;</
title>
10139N/A<
para>See <
olink targetdocent="REFMAN5" localinfo="attributes-5"><
citerefentry>
10139N/A<
refentrytitle>attributes</
refentrytitle><
manvolnum>5</
manvolnum></
citerefentry></
olink>
10139N/Afor descriptions of the following attributes:</
para>
10139N/A<
tgroup cols="2" colsep="1" rowsep="1"><
colspec colname="COLSPEC0" colwidth="1*">
10139N/A<
colspec colname="COLSPEC1" colwidth="1*">
10139N/A<
row><
entry align="center" valign="middle">ATTRIBUTE TYPE</
entry><
entry align="center" 10139N/Avalign="middle">ATTRIBUTE VALUE</
entry></
row>
10139N/A<
row><
entry colname="COLSPEC0"><
para>Interface stability</
para></
entry><
entry 13623N/Acolname="COLSPEC1"><
para>Uncommitted</
para></
entry></
row>
10139N/A<
refsect1 id="jpegtran-1-also"><
title>&also-tt;</
title>
10139N/A<!--Reference to another man page--> 10139N/A<!--Reference to a Help manual--> 10139N/A<
para>Wallace, Gregory K., <
citetitle>The JPEG Still Picture Compression Standard
10139N/A</
citetitle> Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
10139N/A<
para><
citerefentry><
refentrytitle>cjpeg</
refentrytitle><
manvolnum>1</
manvolnum>
10139N/A</
citerefentry>, <
citerefentry><
refentrytitle>djpeg</
refentrytitle><
manvolnum>
10139N/A1</
manvolnum></
citerefentry>, <
citerefentry><
refentrytitle>rdjpgcom</
refentrytitle>
10139N/A<
manvolnum>1</
manvolnum></
citerefentry>, <
citerefentry><
refentrytitle>wrjpgcom
10139N/A</
refentrytitle><
manvolnum>1</
manvolnum></
citerefentry></
para>
10139N/A<
refsect1 id="jpegtran-1-note"><
title>¬e-tt;</
title>
10139N/A<
para>Arithmetic coding is not supported. </
para>
10139N/A<
para>The entire image is read into memory and then written out again, even
10139N/Ain cases where this is not really necessary. Expect swapping on large images,
10139N/Aespecially when using the more complex transform options.</
para>
10139N/A<
para>This man page was originally written by the Independent JPEG Group.
10139N/AUpdated by Breda McColgan, Sun Microsystems Inc., 2004. </
para>