<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<!-- lifted from troff+man by doclifter -->
<refentry id='cjpegl1'>
<!--  @(#)cjpegl.1 2001/04/02 NIST -->
<!--  I Image Group -->
<!--  Craig Watson and Michael D. Garris -->

<refmeta>
<refentrytitle>CJPEGL</refentrytitle>
<manvolnum>1D</manvolnum>
<refmiscinfo class='date'>02 April 2001</refmiscinfo>
<refmiscinfo class='source'>NIST</refmiscinfo>
<refmiscinfo class='manual'>NFIS Reference Manual</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>cjpegl</refname>
<refpurpose>compresses a grayscale or color image using Lossless JPEG (JPEGL).</refpurpose>
</refnamediv>
<!-- body begins here -->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
  <command>cjpegl</command>    
    <arg choice='plain'><replaceable>&lt;outext&gt;&lt;imagefile&gt;</replaceable></arg>
    <sbr/>
    <arg choice='opt'><arg choice='plain'>-raw_in <replaceable>w,h,d,</replaceable></arg><arg choice='opt'><replaceable>ppi</replaceable></arg><arg choice='opt'>-nonintrlv </arg><sbr/><arg choice='opt'>-YCbCr <replaceable>H0,V0:H1,V1:H2,V2</replaceable></arg></arg>
    <arg choice='opt'><replaceable>commentfile</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>


<refsect1 id='description'><title>DESCRIPTION</title>
<para><emphasis remap='B'>Cjpegl</emphasis>
takes as input a file containing an uncompressed grayscale or color
image.  Two possible input file formats are accepted, NIST IHead
files and raw pixmap files.  If a raw pixmap file is to be compressed,
then its image attributes must be provided on the command line as well.
Once read into memory, the grayscale or color pixmap is then
compressed using Lossless JPEG (JPEGL).
The JPEGL results are then written to an output file.</para>

<para>The color components of RGB pixels in a raw pixmap file may
be interleaved or non-interleaved.  By default, <command>cjpegl</command>
assumes interleaved color pixels.  In fact <command>cjpegl</command>'s internal
encoder requires non-interleaved components planes; therefore,
interleaved pixmaps are automatically converted prior to encoding
and results are stored accordingly.
(See INTERLEAVE OPTIONS below.)</para>

<para><emphasis remap='B'>Cjpegl</emphasis> also supports the compression of raw pixmap files
containing YCbCr images with potentially downsampled component planes.
By default, this utility assumes no downsampling of component planes.
(See YCbCr OPTIONS below.)  Regarding color pixmaps, the NIST IHead
file format only supports interleaved RGB images.</para>

</refsect1>

<refsect1 id='options'><title>OPTIONS</title>
<para>All switch names may be abbreviated; for example,
<option>-raw_in</option> may be written <option>-r</option>.</para>
<variablelist remap='TP'>
  <varlistentry>
  <term><emphasis remap='I'>&lt;outext&gt;</emphasis></term>
  <listitem>
<para>the extension of the compressed output file.
To construct the output filename, <command>cjpegl</command> takes the
input filename and replaces its extension with the one
specified here.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>&lt;image file&gt;</emphasis></term>
  <listitem>
<para>the input file, either an IHead file or raw pixmap file,
containing the grayscale or color image to be compressed.</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><option>-raw_in </option><emphasis remap='I'>w</emphasis>,<emphasis remap='I'>h</emphasis>,<emphasis remap='I'>d</emphasis>,[<emphasis remap='I'>ppi</emphasis>]</term>
  <listitem>
<para>the attributes of the input image.  This option must
be included on the command line if the input is a
raw pixmap file.</para>
<!-- .br -->
  <!-- .RS -->
  </listitem>
  </varlistentry>
</variablelist>
<variablelist remap='TP'>
  <varlistentry>
  <term><emphasis remap='I'>w</emphasis></term>
  <listitem>
<para>the pixel width of the pixmap</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>h</emphasis></term>
  <listitem>
<para>the pixel height of the pixmap</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>d</emphasis></term>
  <listitem>
<para>the pixel depth of the pixmap</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>ppi</emphasis></term>
  <listitem>
<para>the optional scan resolution of the image in integer units of
pixels per inch.</para>
  </listitem>
  </varlistentry>
</variablelist>
<!-- .RE -->
<variablelist remap='TP'>
  <varlistentry>
  <term><option>-nonintrlv</option></term>
  <listitem>
<para>specifies that the color components in an <emphasis remap='I'>input</emphasis> raw pixmap file
image are non-interleaved and stored in separate component planes.
(See INTERLEAVE OPTIONS below.)</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><option>-YCbCr </option><emphasis remap='I'>H0</emphasis>,<emphasis remap='I'>V0</emphasis>:<emphasis remap='I'>H1</emphasis>,<emphasis remap='I'>V1</emphasis>:<emphasis remap='I'>H2</emphasis>,<emphasis remap='I'>V2</emphasis></term>
  <listitem>
<para>denotes an <emphasis remap='I'>input</emphasis> raw pixmap file containing a YCbCr colorspace image
and whether any component planes have been <emphasis remap='I'>previously</emphasis> downsampled.
H,V factors all set to 1 represent no downsampling.
(See YCbCr Options below.)</para>
  </listitem>
  </varlistentry>
  <varlistentry>
  <term><emphasis remap='I'>comment file</emphasis></term>
  <listitem>
<para>an optional user-supplied ASCII comment file.  (See COMMENT
OPTIONS below.)</para>

  </listitem>
  </varlistentry>
</variablelist>
</refsect1>

<refsect1 id='interleave_options'><title>INTERLEAVE OPTIONS</title>
<para>The color components of RGB pixels in a raw pixmap file may
be interleaved or non-interleaved.  Color components are interleaved
when a pixel's (R)ed, (G)reen, and (B)lue components are sequentially
adjacent in the image byte stream, ie. RGBRGBRGB... .  If the color
components are non-interleaved, then all (R)ed components in the
image are sequentially adjacent in the image byte stream, followed
by all (G)reen components, and then lastly followed by all (B)lue
components.  Each complete sequence of color components is called
a <emphasis remap='I'>plane</emphasis>.  The utilities <emphasis remap='B'>intr2not</emphasis> and <emphasis remap='B'>not2intr</emphasis>
convert between interleaved and non-interleaved color components.
By default, <command>cjpegl</command> assumes interleaved
color components, and all color IHead images must be
interleaved.  Note that <command>cjpegl</command>'s internal encoder requires
non-interleaved component planes; therefore, interleaved pixmaps
are automatically converted prior to encoding and results are
stored accordingly.</para>

</refsect1>

<refsect1 id='ycbcr_options'><title>YCbCr OPTIONS</title>
<para><emphasis remap='B'>Cjpegl</emphasis> compresses color images with 3 components
per pixel, including RGB and YCbCr colorspaces.  A common compression
technique for YCbCr images is to downsample the Cb &amp; Cr component
planes.
<emphasis remap='B'>Cjpegl</emphasis> supports a limited range of YCbCr downsampling
schemes that are represented by a list of component plane factors.
These factors together represent downsampling ratios relative to
each other.  The comma-separated list of factor pairs correspond to
the Y, Cb, and
Cr component planes respectively.  The first value in a factor
pair represents the downsampling of that particular component plane
in the X-dimension, while the second represents the Y-dimension.
Compression ratios for a particular component plane are calculated
by dividing the maximum component factors in the list by the current
component's factors.  These integer factors are limited
between 1 and 4.  H,V factors all set to 1 represent
no downsampling.  For complete details, <command>cjpegl</command> implements
the downsampling and interleaving schemes described in the
following reference:</para>

<!-- .RS -->
<para>W.B. Pennebaker and J.L. Mitchell, "JPEG: Still Image Compression
Standard," Appendix A - "ISO DIS 10918-1 Requirements and Guidelines,"
Van Nostrand Reinhold, NY, 1993, pp. A1-A4.</para>
<!-- .RE -->

<para>For example the option specification:</para>

<!-- .RS -->
<para>-YCbCr 4,4:2,2:1,1</para>
<!-- .RE -->

<para>represents a YCbCr image with non-downsampled Y component plane
(4,4 are the largest X and Y factors listed); the Cb component
plane is downsampled in X and Y by a factor of 2
(maximum factors 4 divided by current factors 2); and the Cr component
plane is downsampled in X and Y by a factor of 4 (maximum factors 4 divided
by current factors 1).  Note that downsampling component planes
is a form of <emphasis remap='I'>lossy</emphasis> compression,  so while <command>cjpegl</command>
enables the image byte stream associated with an input YCbCr
image to be reconstructed perfectly, if any of
its component planes were previously downsampled, then image
loss has already taken place.  The utility <emphasis remap='B'>rgb2ycc</emphasis> converts
an RGB image to the YCbCr colorspace, and it will conduct component
plane downsampling as specified.  Note that IHead images can only
have RGB color components, so YCbCr options only pertain to
raw pixmap files.</para>

</refsect1>

<refsect1 id='comment_options'><title>COMMENT OPTIONS</title>
<para>Upon successful compression, this utility generates and inserts
in the compressed output file a specially formatted comment block,
called a NISTCOM.  A NISTCOM is a text-based attribute list comprised
of (name, value) pairs, one pair per text line.
The first line of a NISTCOM always has name = "NIST_COM" 
and its value is always the total number of attributes included in
the list.  The utility <emphasis remap='B'>rdjpgcom</emphasis> scans a JPEG compressed file for
any and all comment blocks.  Once found, the contents of each comment
block is printed to standard output.  Using this utility, the NISTCOM
provides easy access to relevant image attributes.  The following is
an example NISTCOM generated by <command>cjpegl</command>:</para>

<!-- .RS -->
<para>NIST_COM 11
<!-- .br -->
PIX_WIDTH 768
<!-- .br -->
PIX_HEIGHT 1024
<!-- .br -->
PIX_DEPTH 24
<!-- .br -->
PPI -1
<!-- .br -->
LOSSY 0
<!-- .br -->
NUM_COMPONENTS 3
<!-- .br -->
HV_FACTORS 1,1:1,1:1,1
<!-- .br -->
INTERLEAVE 0
<!-- .br -->
COMPRESSION JPEGL
<!-- .br -->
JPEGL_PREDICT 4</para>

<!-- .RE -->
<para><emphasis remap='B'>Cjpegl</emphasis> also accepts an optional comment file on the command
line.  If provided, the contents of this file are also inserted
into the compressed output file.  If the comment file is a
NISTCOM attribute list, then its contents are merged with the
NISTCOM internally generated by <command>cjpegl</command> and a single NISTCOM
is written to the compressed output file.  Note that <command>cjpegl</command>
gives precedence to internally generated attribute values.
If the user provides a non-NISTCOM comment file,
then the contents of file are stored to a separate comment block in
the output file.  Using these comment options enables the user
to store application-specific information in a JPEG file.</para>

</refsect1>

<refsect1 id='examples'><title>EXAMPLES</title>
<para>From <emphasis remap='I'>test/imgtools/execs/cjpegl/cjpegl.src</emphasis>:</para>

<!-- .RS -->
<para><emphasis remap='B'>% cjpegl jpl face.raw -r 768,1024,24</emphasis>
<!-- .br -->
compresses a color face image in a raw pixmap file.</para>

</refsect1>

<refsect1 id='see_also'><title>SEE ALSO</title>
<para><emphasis remap='B'>cjpegb</emphasis>(1D),
<emphasis remap='B'>djpegl</emphasis>(1D),
<emphasis remap='B'>dpyimage</emphasis>(1D),
<emphasis remap='B'>intr2not</emphasis>(1D),
<emphasis remap='B'>not2intr</emphasis>(1D),
<emphasis remap='B'>rdjpgcom</emphasis>(1E),
<emphasis remap='B'>rgb2ycc</emphasis>(1D),
<emphasis remap='B'>wrjpgcom</emphasis>(1E)</para>

</refsect1>

<refsect1 id='author'><title>AUTHOR</title>
<para>NIST/ITL/DIV894/Image Group</para>
</refsect1>
</refentry>

