\batchmode
\documentclass[a4paper,twocolumn,dvips]{book}
\RequirePackage{ifthen}


\usepackage[dvips]{graphicx,color}
\usepackage{times}
\usepackage{fancyhdr}
\usepackage{html}



%
\providecommand{\ct}[1]{\texttt{#1}} 

%
\providecommand{\ctr}[1]{\texttt{#1}$\Rightarrow$\-} 



%
\newenvironment{ctd}{\begin{quote}\tt}{\end{quote}} 



\pagecolor{white} 

%
\providecommand{\ip}{\texttt{ip}}%
\providecommand{\bs}{$\backslash$}%
\providecommand{\rtp}{\^{ }}%
\providecommand{\cielab}{\emph{CIE~}$L^{*}a^{*}b^{*}$}%
\providecommand{\ciexyz}{\emph{CIE XYZ}} 

%
\providecommand{\pref}[1]{\S\ref{#1}} 

%
\providecommand{\fig}[2]{
	\begin{center}
	\includegraphics[height=#1]{figs/#2}
	\end{center}
} 

%
\providecommand{\figw}[2]{
	\begin{center}
	\includegraphics[width=#1]{figs/#2}
	\end{center}
} 



%
\newenvironment{fig2}{\begin{figure*}}{\end{figure*}} 
\renewenvironment{fig2}{\begin{figure}}{\end{figure}}

%
\newenvironment{tab2}{\begin{table*}}{\end{table*}} 
\renewenvironment{tab2}{\begin{table}}{\end{table}}

%
\newenvironment{ipdef}{


\samepage
\begin{quote}\tt \begin{tabular}{@{\hspace{0.2em}}ll@{\hspace{0.2em}}ll@{\hspace{0.2em}}ll@{\hspace{0.2em}}ll@{\hspace{0.2em}}ll@{\hspace{0.2em}}ll@{\hspace{0.2em}}ll@{\hspace{0.2em}}lllllllllllllllllllllllllllll}
~~~ & ~ & ~~~ & ~ & ~~~ & ~ & ~~~ & ~ & ~~~ & ~ & ~~~ & ~ & ~~~ & ~ & ~~~ & \\[-1.3em]
}{
\end{tabular}\end{quote}

} 

%
\providecommand{\dtxt}[1]{\multicolumn{25}{l}{#1}} 

%
\providecommand{\blankpage}{%
\newpage
~~~~
\pagestyle{plain}
\newpage
~~~~
\newpage
\pagestyle{fancy}
} 



\addtolength{\textwidth}{0.5in} 

\addtolength{\oddsidemargin}{-0.25in} 

\addtolength{\evensidemargin}{-0.25in} 



\addtolength{\topmargin}{-0.5em} 

\addtolength{\headsep}{0.5em} 

\addtolength{\footskip}{0.5em} 



\newlength{\fred} 

\setlength{\fred}{\oddsidemargin} 

\setlength{\oddsidemargin}{\evensidemargin} 

\setlength{\evensidemargin}{\fred} 


\fancyhead{} % clear all fields
\fancyhead[LE,RO]{\leftmark}		% left-even, right-odd
\fancyhead[RE,LO]{Application Programmers' Guide}% right-even, left-odd
\fancyfoot[LE,RO]{\thepage }		% left-even, right-odd
\fancyfoot[RE,LO]{October 2004}		




\usepackage[latin1]{inputenc}



\makeatletter

\makeatletter
\count@=\the\catcode`\_ \catcode`\_=8 
\newenvironment{tex2html_wrap}{}{}%
\catcode`\<=12\catcode`\_=\count@
\newcommand{\providedcommand}[1]{\expandafter\providecommand\csname #1\endcsname}%
\newcommand{\renewedcommand}[1]{\expandafter\providecommand\csname #1\endcsname{}%
  \expandafter\renewcommand\csname #1\endcsname}%
\newcommand{\newedenvironment}[1]{\newenvironment{#1}{}{}\renewenvironment{#1}}%
\let\newedcommand\renewedcommand
\let\renewedenvironment\newedenvironment
\makeatother
\let\mathon=$
\let\mathoff=$
\ifx\AtBeginDocument\undefined \newcommand{\AtBeginDocument}[1]{}\fi
\newbox\sizebox
\setlength{\hoffset}{0pt}\setlength{\voffset}{0pt}
\addtolength{\textheight}{\footskip}\setlength{\footskip}{0pt}
\addtolength{\textheight}{\topmargin}\setlength{\topmargin}{0pt}
\addtolength{\textheight}{\headheight}\setlength{\headheight}{0pt}
\addtolength{\textheight}{\headsep}\setlength{\headsep}{0pt}
\setlength{\textwidth}{349pt}
\newwrite\lthtmlwrite
\makeatletter
\let\realnormalsize=\normalsize
\global\topskip=2sp
\def\preveqno{}\let\real@float=\@float \let\realend@float=\end@float
\def\@float{\let\@savefreelist\@freelist\real@float}
\def\liih@math{\ifmmode$\else\bad@math\fi}
\def\end@float{\realend@float\global\let\@freelist\@savefreelist}
\let\real@dbflt=\@dbflt \let\end@dblfloat=\end@float
\let\@largefloatcheck=\relax
\let\if@boxedmulticols=\iftrue
\def\@dbflt{\let\@savefreelist\@freelist\real@dbflt}
\def\adjustnormalsize{\def\normalsize{\mathsurround=0pt \realnormalsize
 \parindent=0pt\abovedisplayskip=0pt\belowdisplayskip=0pt}%
 \def\phantompar{\csname par\endcsname}\normalsize}%
\def\lthtmltypeout#1{{\let\protect\string \immediate\write\lthtmlwrite{#1}}}%
\newcommand\lthtmlhboxmathA{\adjustnormalsize\setbox\sizebox=\hbox\bgroup\kern.05em }%
\newcommand\lthtmlhboxmathB{\adjustnormalsize\setbox\sizebox=\hbox to\hsize\bgroup\hfill }%
\newcommand\lthtmlvboxmathA{\adjustnormalsize\setbox\sizebox=\vbox\bgroup %
 \let\ifinner=\iffalse \let\)\liih@math }%
\newcommand\lthtmlboxmathZ{\@next\next\@currlist{}{\def\next{\voidb@x}}%
 \expandafter\box\next\egroup}%
\newcommand\lthtmlmathtype[1]{\gdef\lthtmlmathenv{#1}}%
\newcommand\lthtmllogmath{\lthtmltypeout{l2hSize %
:\lthtmlmathenv:\the\ht\sizebox::\the\dp\sizebox::\the\wd\sizebox.\preveqno}}%
\newcommand\lthtmlfigureA[1]{\let\@savefreelist\@freelist
       \lthtmlmathtype{#1}\lthtmlvboxmathA}%
\newcommand\lthtmlpictureA{\bgroup\catcode`\_=8 \lthtmlpictureB}%
\newcommand\lthtmlpictureB[1]{\lthtmlmathtype{#1}\egroup
       \let\@savefreelist\@freelist \lthtmlhboxmathB}%
\newcommand\lthtmlpictureZ[1]{\hfill\lthtmlfigureZ}%
\newcommand\lthtmlfigureZ{\lthtmlboxmathZ\lthtmllogmath\copy\sizebox
       \global\let\@freelist\@savefreelist}%
\newcommand\lthtmldisplayA{\bgroup\catcode`\_=8 \lthtmldisplayAi}%
\newcommand\lthtmldisplayAi[1]{\lthtmlmathtype{#1}\egroup\lthtmlvboxmathA}%
\newcommand\lthtmldisplayB[1]{\edef\preveqno{(\theequation)}%
  \lthtmldisplayA{#1}\let\@eqnnum\relax}%
\newcommand\lthtmldisplayZ{\lthtmlboxmathZ\lthtmllogmath\lthtmlsetmath}%
\newcommand\lthtmlinlinemathA{\bgroup\catcode`\_=8 \lthtmlinlinemathB}
\newcommand\lthtmlinlinemathB[1]{\lthtmlmathtype{#1}\egroup\lthtmlhboxmathA
  \vrule height1.5ex width0pt }%
\newcommand\lthtmlinlineA{\bgroup\catcode`\_=8 \lthtmlinlineB}%
\newcommand\lthtmlinlineB[1]{\lthtmlmathtype{#1}\egroup\lthtmlhboxmathA}%
\newcommand\lthtmlinlineZ{\egroup\expandafter\ifdim\dp\sizebox>0pt %
  \expandafter\centerinlinemath\fi\lthtmllogmath\lthtmlsetinline}
\newcommand\lthtmlinlinemathZ{\egroup\expandafter\ifdim\dp\sizebox>0pt %
  \expandafter\centerinlinemath\fi\lthtmllogmath\lthtmlsetmath}
\newcommand\lthtmlindisplaymathZ{\egroup %
  \centerinlinemath\lthtmllogmath\lthtmlsetmath}
\def\lthtmlsetinline{\hbox{\vrule width.1em \vtop{\vbox{%
  \kern.1em\copy\sizebox}\ifdim\dp\sizebox>0pt\kern.1em\else\kern.3pt\fi
  \ifdim\hsize>\wd\sizebox \hrule depth1pt\fi}}}
\def\lthtmlsetmath{\hbox{\vrule width.1em\kern-.05em\vtop{\vbox{%
  \kern.1em\kern0.8 pt\hbox{\hglue.17em\copy\sizebox\hglue0.8 pt}}\kern.3pt%
  \ifdim\dp\sizebox>0pt\kern.1em\fi \kern0.8 pt%
  \ifdim\hsize>\wd\sizebox \hrule depth1pt\fi}}}
\def\centerinlinemath{%
  \dimen1=\ifdim\ht\sizebox<\dp\sizebox \dp\sizebox\else\ht\sizebox\fi
  \advance\dimen1by.5pt \vrule width0pt height\dimen1 depth\dimen1 
 \dp\sizebox=\dimen1\ht\sizebox=\dimen1\relax}

\def\lthtmlcheckvsize{\ifdim\ht\sizebox<\vsize 
  \ifdim\wd\sizebox<\hsize\expandafter\hfill\fi \expandafter\vfill
  \else\expandafter\vss\fi}%
\providecommand{\selectlanguage}[1]{}%
\makeatletter \tracingstats = 1 


\begin{document}
\pagestyle{empty}\thispagestyle{empty}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength hsize=\the\hsize}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength vsize=\the\vsize}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength hoffset=\the\hoffset}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength voffset=\the\voffset}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength topmargin=\the\topmargin}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength topskip=\the\topskip}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength headheight=\the\headheight}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength headsep=\the\headsep}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength parskip=\the\parskip}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength oddsidemargin=\the\oddsidemargin}\lthtmltypeout{}%
\makeatletter
\if@twoside\lthtmltypeout{latex2htmlLength evensidemargin=\the\evensidemargin}%
\else\lthtmltypeout{latex2htmlLength evensidemargin=\the\oddsidemargin}\fi%
\lthtmltypeout{}%
\makeatother
\setcounter{page}{1}
\onecolumn

% !!! IMAGES START HERE !!!

\stepcounter{chapter}
{\newpage\clearpage
\lthtmlpictureA{tex2html_wrap1760}%
\includegraphics[width=6in]{figs/arch.eps}%
\lthtmlpictureZ
\lthtmlcheckvsize\clearpage}

\stepcounter{chapter}
\stepcounter{section}
{\newpage\clearpage
\lthtmlinlinemathA{tex2html_wrap_inline438}%
$L^{*}a^{*}b^{*}$%
\lthtmlinlinemathZ
\lthtmlcheckvsize\clearpage}

{\newpage\clearpage
\lthtmlinlinemathA{tex2html_wrap_inline440}%
$^{-1}$%
\lthtmlinlinemathZ
\lthtmlcheckvsize\clearpage}

\stepcounter{section}
\stepcounter{section}
{\newpage\clearpage
\lthtmlinlinemathA{tex2html_wrap_inline446}%
$L^{*}$%
\lthtmlinlinemathZ
\lthtmlcheckvsize\clearpage}

{\newpage\clearpage
\lthtmlinlinemathA{tex2html_wrap_inline448}%
$a^{*}$%
\lthtmlinlinemathZ
\lthtmlcheckvsize\clearpage}

{\newpage\clearpage
\lthtmlinlinemathA{tex2html_wrap_inline450}%
$b^{*}$%
\lthtmlinlinemathZ
\lthtmlcheckvsize\clearpage}

\stepcounter{chapter}
\stepcounter{section}
{\newpage\clearpage
\lthtmlfigureA{figure655}%
\begin{figure}\begin{quote}
\begin{verbatim}

typedef struct {
    /* Fields from image header.
     */
    int Xsize;             /* Pels per line */
    int Ysize;             /* Lines */
    int Bands;             /* Number of bands */
    int Bbits;             /* Bits per band */
    int BandFmt;           /* Band format */
    int Coding;            /* Coding type */
    int Type;              /* Type of file */
    float XRes;            /* Horizontal res in pels/mm */
    float YRes;            /* Vertical res in pels/mm  */
    int Length;            /* Obsolete (unused) */
    short Compression;     /* Obsolete (unused) */
    short Level;           /* Obsolete (unused) */
    int Xoffset;           /* Position of origin */    
    int Yoffset;
   
    /* Derived fields that may be read by the user. 
     */
    char *Hist;            /* History information */
    char *filename;        /* File name */
    struct time_info *time;/* Timing for eval callback */
    int kill;              /* Set to non-zero to block eval */

    ... and lots of other private fields used by VIPS for 
    ... housekeeping.
} IMAGE;\end{verbatim}

\end{quote}

\end{figure}%
\lthtmlfigureZ
\lthtmlcheckvsize\clearpage}

\stepcounter{section}
\stepcounter{section}
{\newpage\clearpage
\lthtmlfigureA{figure657}%
\begin{figure}\begin{quote}
\begin{verbatim}

#include <stdio.h>
#include <vips/vips.h>

int
main( int argc, char **argv )
{
    IMAGE *im;

    /* Check arguments.
     */
    if( argc != 2 )
        error_exit( "usage: %s filename", argv[0] );

    /* Open file.
     */
    if( !(im = im_open( argv[1], "r" )) )
        error_exit( "unable to open %s for input", argv[1] );

    /* Process.
     */
    printf( "width = %d, height = %d\n", im->Xsize, im->Ysize );

    /* Close.
     */
    if( im_close( im ) )
        error_exit( "unable to close %s", argv[1] );

    return( 0 );
}\end{verbatim}

\end{quote}
\end{figure}%
\lthtmlfigureZ
\lthtmlcheckvsize\clearpage}

{\newpage\clearpage
\lthtmlfigureA{figure659}%
\begin{figure}\begin{quote}
\begin{verbatim}

#include <stdio.h>
#include <vips/vips.h>

int
main( int argc, char **argv )
{
    IMAGE *in, *out;

    /* Check arguments.
     */
    if( argc != 3 )
        error_exit( "usage: %s infile outfile", argv[0] );

    /* Open images for read and write, invert, update the history with our
     * args, and close.
     */
    if( !(in = im_open( argv[1], "r" )) ||
        !(out = im_open( argv[2], "w" )) ||
        im_invert( in, out ) ||
        im_updatehist( out, argc, argv ) ||
        im_close( in ) || 
        im_close( out ) )
        error_exit( argv[0] );
    
    return( 0 );
}\end{verbatim}

\end{quote}
\end{figure}%
\lthtmlfigureZ
\lthtmlcheckvsize\clearpage}

\stepcounter{section}
\stepcounter{section}
\stepcounter{section}
\stepcounter{subsection}
{\newpage\clearpage
\lthtmlfigureA{figure661}%
\begin{figure}\begin{quote}
\begin{verbatim}

/* Add another image to the accumulated total.
 */
static int
sum1( IMAGE *acc, IMAGE **in, int nin, IMAGE *out )
{
    IMAGE *t;

    if( nin == 0 )
        /* All done ... copy to out.
         */
        return( im_copy( acc, out ) );

    /* Make a new intermediate, and add to it..
     */
    return( !(t = im_open_local( out, "sum1:1", "p" )) || 
        im_add( acc, in[0], t ) || 
        sum1( t, in + 1, nin - 1, out ) );
}

/* Sum the array of images in[]. nin is the number of images in
 * in[], out is the descriptor we write the final image to.
 */
int
total( IMAGE **in, int nin, IMAGE *out )
{
    /* Check that we have at least one image.
     */
    if( nin <= 0 ) {
        im_error( "total", "nin should be > 0" );
        return( -1 );
    }

    /* More than 1, sum recursively.
     */
    return( sum1( in[0], in + 1, nin - 1, out ) );
}\end{verbatim}

\end{quote}

\end{figure}%
\lthtmlfigureZ
\lthtmlcheckvsize\clearpage}

\stepcounter{subsection}
\stepcounter{subsection}
\stepcounter{section}
\stepcounter{section}
{\newpage\clearpage
\lthtmlfigureA{figure663}%
\begin{figure}\begin{quote}
\begin{verbatim}

int 
im_Lab2disp( IMAGE *in, IMAGE *out, struct im_col_display *disp )
{	
    IMAGE *t1;

    if( !(t1 = im_open_local( out, "im_Lab2disp:1", "p" )) ||
        im_Lab2XYZ( in, t1 ) ||
        im_XYZ2disp( t1, out, disp ) )
        return( -1 );

    return( 0 );
}\end{verbatim}

\end{quote}

\end{figure}%
\lthtmlfigureZ
\lthtmlcheckvsize\clearpage}

\stepcounter{subsection}
\stepcounter{subsection}
\stepcounter{subsection}
\stepcounter{subsection}
{\newpage\clearpage
\lthtmlfigureA{figure665}%
\begin{figure}\begin{quote}
\begin{verbatim}

int
threshold_at_mean( IMAGE *in, IMAGE *out )
{
    double mean;

    if( im_avg( in, &mean ) ||
        im_moreconst( in, out, mean ) )
        return( -1 );

    return( 0 );
}\end{verbatim}

\end{quote}

\end{figure}%
\lthtmlfigureZ
\lthtmlcheckvsize\clearpage}

\stepcounter{subsection}
\stepcounter{subsection}
\stepcounter{chapter}
\stepcounter{section}
\stepcounter{section}
\stepcounter{section}
\stepcounter{section}
\stepcounter{subsection}
\stepcounter{subsection}
\stepcounter{subsection}

\end{document}
