cjpeg.1 revision 18745
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-->
13666N/A<!--ARC : LSARC 2003/085 libtiff, libjpeg, and libpng-->
10139N/A<!ENTITY cmd "cjpeg">
10139N/A<!ENTITY % commonents SYSTEM "smancommon.ent">
10139N/A%commonents;
10139N/A<!ENTITY % booktitles SYSTEM "booktitles.ent">
10139N/A%booktitles;
10139N/A<!ENTITY suncopy "Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.">
10139N/A]>
10139N/A<?Pub UDT _bookmark _target>
10139N/A<?Pub Inc>
10139N/A<refentry id="cjpeg-1">
10139N/A<!-- %Z%%M% %I% %E% SMI; -->
10139N/A<refmeta><refentrytitle>cjpeg</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</refmeta>
10139N/A<indexterm><primary>cjpeg</primary></indexterm><indexterm><primary>compress
10139N/Aan image file to a JPEG file</primary></indexterm>
10139N/A<refnamediv id="cjpeg-1-name"><refname>cjpeg</refname><refpurpose>compress
10139N/Aan image file to a JPEG file</refpurpose></refnamediv>
10139N/A<refsynopsisdiv id="cjpeg-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</cmdsynopsis></refsynopsisdiv>
10139N/A<refsect1 id="cjpeg-1-desc"><title>&desc-tt;</title>
10139N/A<para><command>&cmd;</command> compresses the named image file, or the standard
10139N/Ainput if no file is named, and produces a JPEG/JFIF file on the standard output.
10139N/AThe following input file formats are currently supported:</para>
10139N/A<itemizedlist>
10139N/A<listitem><para>BMP</para></listitem>
10139N/A<listitem><para>PGM, the PBMPLUS gray-scale format</para></listitem>
10139N/A<listitem><para>PPM, the PBMPLUS color format</para></listitem>
10139N/A<listitem><para>RLE, the Utah Raster Toolkit format</para></listitem>
10139N/A<listitem><para>Targa</para></listitem>
10139N/A</itemizedlist>
10139N/A<para>RLE is supported only if the URT library is available.</para>
10139N/A</refsect1>
10139N/A<refsect1 id="cjpeg-1-opts"><title>&opts-tt;</title>
10139N/A<para>All options may be abbreviated. For example, <option>grayscale</option>
10139N/Amay be written <option>gray</option> or <option>gr</option>. Upper and lower
10139N/Acase are equivalent. For example, <option>BMP</option> is the same as <option>
10139N/Abmp</option>. British spellings are also accepted. For example, <option>greyscale
10139N/A</option>.</para>
10139N/A<refsect2 id="cjpeg-1-opts-basic">
10139N/A<title>Basic Options</title>
10139N/A<para>The following basic options are supported:</para>
10139N/A<variablelist termlength="medium">
10139N/A<varlistentry><term><option>grayscale</option></term><listitem><para>Create
10139N/Aa monochrome JPEG file from color input. You should use this switch when compressing
10139N/Aa grayscale BMP file, because <command>&cmd;</command> cannot detect whether
10139N/Aa BMP file uses only shades of gray. By specifying the <option>grayscale</option>
10139N/Aoption, you create a smaller JPEG file that takes less time to process.</para>
10139N/A</listitem></varlistentry>
10139N/A<varlistentry><term><option>optimize</option></term><listitem><para>Optimize
10139N/Athe entropy encoding parameters. If you do not specify this option, default
10139N/Aencoding parameters are used. <option>optimize</option> usually makes the
10139N/AJPEG file a little smaller, but <command>&cmd;</command> runs more slowly
10139N/Aand needs much more memory. Image quality and speed of decompression are unaffected
10139N/Aby the <option>optimize</option> option.</para>
10139N/A</listitem></varlistentry>
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 the Extended Description section.</para>
10139N/A</listitem></varlistentry>
10139N/A<varlistentry><term><option>quality <replaceable>N</replaceable></option></term>
10139N/A<listitem><para>Scale the quantization tables to adjust image quality. <replaceable>
10139N/AN</replaceable> ranges from 0 (worst) to 100 (best). The default value is
10139N/A75. For more information about the <option>quality</option> option, see the
10139N/AExtended Description section.</para>
10139N/A</listitem></varlistentry>
10139N/A<varlistentry><term><option>targa</option></term><listitem><para>Specify that
10139N/Athe input file is in Targa format. Targa files that contain an "identification"
10139N/Afield are not automatically recognized by <command>&cmd;</command>. For such
10139N/Afiles, you must specify <option>targa</option> to make <command>&cmd;</command>
10139N/Atreat the input as Targa format. For most Targa files, you do not need this
10139N/Aswitch.</para>
10139N/A</listitem></varlistentry>
10139N/A</variablelist></refsect2>
10139N/A<refsect2 id="cjpeg-1-opts-int">
10139N/A<title>Intermediate Options</title>
10139N/A<para>The following intermediate options are supported:</para>
10139N/A<variablelist termlength="medium">
10139N/A<varlistentry><term><option>dct fast</option></term><listitem><para>Use the
10139N/Afast integer DCT method. This method is less accurate than the integer DCT
10139N/Amethod or the floating-point DCT method.</para>
10139N/A</listitem></varlistentry>
10139N/A<varlistentry><term><option>dct float</option></term><listitem><para>Use the
10139N/Afloating-point DCT method. The float method is very slightly more accurate
10139N/Athan the int method, but is much slower unless your machine has very fast
10139N/Afloating-point hardware. The results of the floating-point method may vary
10139N/Aslightly across machines, while the integer methods should give the same results
10139N/Aeverywhere.</para>
10139N/A</listitem></varlistentry>
10139N/A<varlistentry><term><option>dct int</option></term><listitem><para>Use the
10139N/Ainteger DCT method. This is the default method.</para>
10139N/A</listitem></varlistentry>
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/Afiles are used.</para>
10139N/A</listitem></varlistentry>
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/Astandard output.</para>
10139N/A</listitem></varlistentry>
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. The default value is <option>restart 0</option>, which means
10139N/Ano restart markers. For more information about the <option>restart</option>
10139N/Aoption, see the Extended Description section.</para>
10139N/A</listitem></varlistentry>
10139N/A<varlistentry><term><option>smooth <replaceable>N</replaceable></option></term>
10139N/A<listitem><para>Smooth the input image to eliminate dithering noise. <replaceable>
10139N/AN</replaceable> ranges from 1 to 100, and indicates the strength of smoothing.
10139N/AThe default value is <option>smooth 0</option>, which means no smoothing.
10139N/AFor more information about the <option>smooth</option> option, see the Extended
10139N/ADescription section.</para>
10139N/A</listitem></varlistentry>
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>
10139N/A<para>You can also use <option>debug</option> to specify this option.</para>
10139N/A</listitem></varlistentry>
10139N/A</variablelist></refsect2>
10139N/A<refsect2 id="cjpeg-1-opts-adv">
10139N/A<title>Advanced Options</title>
10139N/A<para>The following advanced options are supported for advanced users only:
10139N/A</para>
10139N/A<variablelist termlength="medium">
10139N/A<varlistentry><term><option>baseline</option></term><listitem><para>Force
10139N/Abaseline-compatible quantization tables to be generated. This clamps the quantization
10139N/Avalues to 8 bits, even at low quality settings. This option is poorly named,
10139N/Abecause <option>baseline</option> does not ensure that the output is actually
10139N/Abaseline JPEG. For example, you can use the <option>baseline</option> and <option>
10139N/Aprogressive</option> options together.</para>
10139N/A</listitem></varlistentry>
10139N/A<varlistentry><term><option>qslots <replaceable>N</replaceable>[,...]</option></term>
10139N/A<listitem><para>Select which quantization table to use for each color component.
10139N/A</para>
10139N/A</listitem></varlistentry>
10139N/A<varlistentry><term><option>qtables <replaceable>file</replaceable></option></term>
10139N/A<listitem><para>Use the quantization tables provided in the specified text
10139N/Afile.</para>
10139N/A</listitem></varlistentry>
10139N/A<varlistentry><term><option>sample HxV[,...]</option></term><listitem><para>
10139N/ASet the JPEG sampling factors for each color component.</para>
10139N/A</listitem></varlistentry>
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</listitem></varlistentry>
10139N/A</variablelist></refsect2>
10139N/A</refsect1>
10139N/A<refsect1 id="cjpeg-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 image file to be compressed.</para>
10139N/A</listitem></varlistentry>
10139N/A</variablelist></refsect1>
10139N/A<refsect1 id="cjpeg-1-exde"><title>&exde-tt;</title>
10139N/A<refsect2 id="cjpeg-1-exde-quality">
10139N/A<title>The <option>quality</option> Option</title>
10139N/A<para>The <option>quality</option> option enables you to trade compressed
10139N/Afile size against the quality of the reconstructed image: the higher the quality
10139N/Asetting, the larger the JPEG file, and the greater the similarity between
10139N/Athe output image and the original input. Normally, you use the lowest quality
10139N/Asetting that decompresses into an output image that is visually indistinguishable
10139N/Afrom the original image. For this purpose, the quality setting should be between
10139N/A50 and 95. The default value of 75 is often just right. If you see defects
10139N/Aat <option>quality 75</option>, increase the quality by 5 until you are happy
10139N/Awith the output image. The optimal setting varies from one image to another.
10139N/A</para>
10139N/A<para>A value of <option>quality 100</option> generates a quantization table
10139N/Aof ones. This minimizes loss in the quantization step, but information is
10139N/Astill lost in subsampling, as well as roundoff error. The <option>quality
10139N/A100</option> setting is mainly of interest for experimental purposes. Quality
10139N/Avalues above 95 are not recommended for normal use, as the compressed file
10139N/Asize increases dramatically for very little gain in output image quality.
10139N/A</para>
10139N/A<para>Quality values below 50 produce very small files of low image quality.
10139N/ASettings of 5 to 10 might be useful in preparing an index of a large image
10139N/Alibrary, for example. Quality values below 25 generate 2-byte quantization
10139N/Atables, which are considered optional in the JPEG standard. <command>&cmd;</command>
10139N/Aemits a warning message when you specify such a quality value, because some
10139N/Aother JPEG programs might be unable to decode the resulting file. Use <option>
10139N/Abaseline</option> if you need to ensure compatibility at low quality values.
10139N/A</para>
10139N/A</refsect2>
10139N/A<refsect2 id="cjpeg-1-exde-prog">
10139N/A<title>The <option>progressive</option> Option</title>
10139N/A<para>The <option>progressive</option> option creates a "progressive JPEG"
10139N/Afile. In this type of JPEG file, the data is stored in multiple scans of increasing
10139N/Aquality. If the file is transmitted over a slow communications link, the decoder
10139N/Acan use the first scan to display a low-quality image very quickly, and can
10139N/Athen improve the display with each subsequent scan. The final image is exactly
10139N/Aequivalent to a standard JPEG file of the same quality setting, and the total
10139N/Afile size is about the same, or a little smaller. Caution: progressive JPEG
10139N/Ais not yet widely implemented, so many decoders are unable to view a progressive
10139N/AJPEG file at all.</para>
10139N/A</refsect2>
10139N/A<refsect2 id="cjpeg-1-exde-restart">
10139N/A<title>The <option>restart</option> Option</title>
10139N/A<para>The <option>restart</option> option inserts extra markers that allow
10139N/Aa JPEG decoder to resynchronize after a transmission error. Without restart
10139N/Amarkers, any damage to a compressed file usually ruins the image from the
10139N/Apoint of the error to the end of the image. With restart markers, the damage
10139N/Ais usually confined to the portion of the image from the point of the error
10139N/Ato the next restart marker. The restart markers occupy extra space. We recommend <option>
10139N/Arestart 1</option> for images that are transmitted across unreliable networks.
10139N/A</para>
10139N/A</refsect2>
10139N/A<refsect2 id="cjpeg-1-exde-smooth">
10139N/A<title>The <option>smooth</option> Option</title>
10139N/A<para>The <option>smooth</option> option filters the input to eliminate fine-scale
10139N/Anoise. This option is often useful when you convert dithered images to JPEG:
10139N/Aa moderate smoothing factor of 10 to 50 deletes dithering patterns from the
10139N/Ainput file, resulting in a smaller JPEG file and a better-looking image. If
10139N/Athe smoothing factor is too large, the image visibly blurs.</para>
10139N/A</refsect2>
10139N/A<refsect2 id="cjpeg-1-exde-hints">
10139N/A<title>Hints</title>
10139N/A<para>Color GIF files are not the ideal input for JPEG. JPEG is really intended
10139N/Afor the compression of full-color 24-bit images. In particular, do not try
10139N/Ato convert cartoons, line drawings, or other images that have only a few distinct
10139N/Acolors. GIF works well on these, but JPEG does not. If you want to convert
10139N/Aa GIF file to JPEG, you should experiment with the <option>quality</option>
10139N/Aand <option>smooth</option> options to get a satisfactory conversion. A value
10139N/Aof <option>smooth 10</option> is often helpful.</para>
10139N/A<para>Avoid running an image through a series of JPEG compression/decompression
10139N/Acycles. Image quality loss will accumulate. After ten cycles, the image may
10139N/Abe noticeably worse than it was after one cycle. Use a lossless format while
10139N/Amanipulating an image, then convert to JPEG format when you are ready to file
10139N/Athe image away. </para>
10139N/A<para>Use the <option>optimize</option> option when you make a "final" version
10139N/Afor posting or archiving. Also, when you use low quality settings, make very
10139N/Asmall JPEG files. The percentage improvement is often much greater than on
10139N/Alarger files. At present, the <option>optimize</option> option is always selected
10139N/Awhen generating progressive JPEG files.</para>
10139N/A</refsect2>
10139N/A</refsect1>
10139N/A<refsect1 id="cjpeg-1-exam"><title>&exam-tt;</title>
10139N/A<example role="example">
10139N/A<title>Compressing the PPM File test.ppm With a Quality Factor of 60 and Saving
10139N/Athe Output as test.jpg</title>
11904N/A<para><screen>example% <userinput>&cmd; -quality 60 test.ppm > test.jpg
10139N/A</userinput></screen></para>
10139N/A</example>
10139N/A</refsect1>
10139N/A<refsect1 id="cjpeg-1-envr"><title>&envr-tt;</title>
10139N/A<para><command>&cmd;</command> uses the following environment variables:</para>
10139N/A<variablelist>
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</listitem></varlistentry>
10139N/A</variablelist></refsect1>
10139N/A<refsect1 id="cjpeg-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<informaltable frame="all">
10139N/A<tgroup cols="2" colsep="1" rowsep="1"><colspec colname="COLSPEC0" colwidth="1*">
10139N/A<colspec colname="COLSPEC1" colwidth="1*">
10139N/A<thead>
10139N/A<row><entry align="center" valign="middle">ATTRIBUTE TYPE</entry><entry align="center"
10139N/Avalign="middle">ATTRIBUTE VALUE</entry></row>
10139N/A</thead>
10139N/A<tbody>
18745N/A<row><entry><para>Availability</para></entry><entry><para>image/library/libjpeg</para></entry>
10139N/A</row>
10139N/A<row><entry colname="COLSPEC0"><para>Interface stability</para></entry><entry
13623N/Acolname="COLSPEC1"><para>Uncommitted</para></entry></row>
10139N/A</tbody>
10139N/A</tgroup>
10139N/A</informaltable>
10139N/A</refsect1>
10139N/A<refsect1 id="cjpeg-1-also"><title>&also-tt;</title>
10139N/A<!--Reference to another man page-->
10139N/A<!--Reference to a Help manual-->
10139N/A<!--Reference to a book.-->
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>
10139N/A<para><citerefentry><refentrytitle>djpeg</refentrytitle><manvolnum>1</manvolnum>
10139N/A</citerefentry>, <citerefentry><refentrytitle>jpegtran</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>
10139N/A<refsect1 id="cjpeg-1-note"><title>&note-tt;</title>
10139N/A<para>Arithmetic coding is not supported. GIF input files are not supported.
10139N/ANot all variants of BMP and Targa file formats are supported.</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>
10139N/A</refsect1>
10139N/A</refentry>