<?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='cjpegb1'>
<!--  @(#)cjpegb.1 2001/04/02 NIST -->
<!--  I Image Group -->
<!--  Craig Watson and Michael D. Garris -->

<refmeta>
<refentrytitle>CJPEGB</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>cjpegb</refname>
<refpurpose>compresses a grayscale or color (RGB) image using lossy Baseline JPEG (JPEGB).</refpurpose>
</refnamediv>
<!-- body begins here -->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
  <command>cjpegb</command>    
    <arg choice='plain'><replaceable>&lt;q=20=95&gt;&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></arg>
    <arg choice='opt'><replaceable>commentfile</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>


<refsect1 id='description'><title>DESCRIPTION</title>
<para><emphasis remap='B'>Cjpegb</emphasis>
takes as input a file containing an uncompressed grayscale or color
(RGB) 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 <emphasis remap='I'>lossy</emphasis>
compressed to a specified level of reconstruction quality using the
Independent JPEG Group's (IJG) library for Baseline JPEG (JPEGB).
The JPEGB results are then written to an output file.</para>

<para>Note that <command>cjpegb</command> calls the IJG library in a default color mode
where one of the compression steps includes a colorspace conversion
from RGB to YCbCr, and then the Cb &amp; Cr component planes are
downsampled by a factor of 2 in both dimensions.  Due to this
colorspace conversion, <command>cjpegb</command> should only be used to
compress RGB color images.</para>

<para>The color components of RGB pixels in a raw pixmap file may
be interleaved or non-interleaved.  By default, <command>cjpegb</command>
assumes interleaved color pixels.  (See INTERLEAVE 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;q=20-95&gt;</emphasis></term>
  <listitem>
<para>specifies the level of quality in the reconstructed image
as a result of lossy compression.  The integer quality value may
range between 20 and 95.  The lower the quality
value, the more drastic the compression.</para>
  </listitem>
  </varlistentry>
  <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>cjpegb</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 (RGB) 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><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>cjpegb</command> assumes interleaved
color components, and note that all color IHead images must be
interleaved.</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>cjpegb</command>:</para>

<!-- .RS -->
<para>NIST_COM 12
<!-- .br -->
PIX_WIDTH 768
<!-- .br -->
PIX_HEIGHT 1024
<!-- .br -->
PIX_DEPTH 24
<!-- .br -->
PPI -1
<!-- .br -->
LOSSY 1
<!-- .br -->
COLORSPACE YCbCr
<!-- .br -->
NUM_COMPONENTS 3
<!-- .br -->
HV_FACTORS 2,2:1,1:1,1
<!-- .br -->
INTERLEAVE 1
<!-- .br -->
COMPRESSION JPEGB
<!-- .br -->
JPEGB_QUALITY 50</para>

<!-- .RE -->
<para><emphasis remap='B'>Cjpegb</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>cjpegb</command> and a single NISTCOM
is written to the compressed output file.  Note that <command>cjpegb</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/cjpegb/cjpegb.src</emphasis>:</para>

<!-- .RS -->
<para><emphasis remap='B'>% cjpegb 50 jpb face08.raw -r 768,1024,8</emphasis>
<!-- .br -->
compresses a grayscale face image in a raw pixmap file.</para>

<para><emphasis remap='B'>% cjpegb 50 jpb face24.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'>cjpeg</emphasis>(1E),
<emphasis remap='B'>cjpegl</emphasis>(1D),
<emphasis remap='B'>djpegb</emphasis>(1D),
<emphasis remap='B'>dpyimage</emphasis>(1D),
<emphasis remap='B'>intr2not</emphasis>(1D),
<emphasis remap='B'>jpegtran</emphasis>(1E),
<emphasis remap='B'>not2intr</emphasis>(1D),
<emphasis remap='B'>rdjpgcom</emphasis>(1E),
<emphasis remap='B'>wrjpgcom</emphasis>(1E)</para>

</refsect1>

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

