roentgen b75cab
.\" $Id: TIFFReadRGBAImage.3tiff,v 1.4 2006-10-13 07:22:01 dron Exp $
roentgen b75cab
.\"
roentgen b75cab
.\" Copyright (c) 1991-1997 Sam Leffler
roentgen b75cab
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
roentgen b75cab
.\"
roentgen b75cab
.\" Permission to use, copy, modify, distribute, and sell this software and 
roentgen b75cab
.\" its documentation for any purpose is hereby granted without fee, provided
roentgen b75cab
.\" that (i) the above copyright notices and this permission notice appear in
roentgen b75cab
.\" all copies of the software and related documentation, and (ii) the names of
roentgen b75cab
.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
roentgen b75cab
.\" publicity relating to the software without the specific, prior written
roentgen b75cab
.\" permission of Sam Leffler and Silicon Graphics.
roentgen b75cab
.\" 
roentgen b75cab
.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
roentgen b75cab
.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
roentgen b75cab
.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
roentgen b75cab
.\" 
roentgen b75cab
.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
roentgen b75cab
.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
roentgen b75cab
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
roentgen b75cab
.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
roentgen b75cab
.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
roentgen b75cab
.\" OF THIS SOFTWARE.
roentgen b75cab
.\"
roentgen b75cab
.if n .po 0
roentgen b75cab
.TH TIFFReadRGBAImage 3TIFF "October 13, 2006" "libtiff"
roentgen b75cab
.SH NAME
roentgen b75cab
TIFFReadRGBAImage, TIFFReadRGBAImageOriented \- read and decode an image
roentgen b75cab
into a fixed-format raster
roentgen b75cab
.SH SYNOPSIS
roentgen b75cab
.B "#include <tiffio.h>"</tiffio.h>
roentgen b75cab
.sp
roentgen b75cab
.B "#define TIFFGetR(abgr) ((abgr) & 0xff)"
roentgen b75cab
.br
roentgen b75cab
.B "#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)"
roentgen b75cab
.br
roentgen b75cab
.B "#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)"
roentgen b75cab
.br
roentgen b75cab
.B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
roentgen b75cab
.sp
roentgen b75cab
.BI "int TIFFReadRGBAImage(TIFF *" tif ", uint32 " width ", uint32 " height ", uint32 *" raster ", int " stopOnError ")"
roentgen b75cab
.br
roentgen b75cab
.BI "int TIFFReadRGBAImageOriented(TIFF *" tif ", uint32 " width ", uint32 " height ", uint32 *" raster ", int " orientation ", int " stopOnError ")"
roentgen b75cab
.br
roentgen b75cab
.SH DESCRIPTION
roentgen b75cab
.IR TIFFReadRGBAImage
roentgen b75cab
reads a strip- or tile-based image into memory, storing the
roentgen b75cab
result in the user supplied
roentgen b75cab
.IR raster .
roentgen b75cab
The raster is assumed to be an array of
roentgen b75cab
.I width
roentgen b75cab
times
roentgen b75cab
.I height
roentgen b75cab
32-bit entries, where
roentgen b75cab
.I width
roentgen b75cab
must be less than or equal to the width of the image (\c
roentgen b75cab
.I height
roentgen b75cab
may be any non-zero size).
roentgen b75cab
If the raster dimensions are smaller than the image, the image data
roentgen b75cab
is cropped to the raster bounds.
roentgen b75cab
If the raster height is greater than that of the image, then the
roentgen b75cab
image data are placed in the lower part of the raster.
roentgen b75cab
(Note that the raster is assume to be organized such that the pixel
roentgen b75cab
at location (\fIx\fP,\fIy\fP) is \fIraster\fP[\fIy\fP*\fIwidth\fP+\fIx\fP];
roentgen b75cab
with the raster origin in the lower-left hand corner.)
roentgen b75cab
.PP
roentgen b75cab
.IR TIFFReadRGBAImageOriented
roentgen b75cab
works like
roentgen b75cab
.IR TIFFReadRGBAImage
roentgen b75cab
with except of that user can specify the raster origin position with the
roentgen b75cab
.I orientation
roentgen b75cab
parameter. Four orientations supported:
roentgen b75cab
.TP
roentgen b75cab
.B ORIENTATION_TOPLEFT
roentgen b75cab
origin in top-left corner,
roentgen b75cab
.TP
roentgen b75cab
.B ORIENTATION_TOPRIGHT
roentgen b75cab
origin in top-right corner,
roentgen b75cab
.TP
roentgen b75cab
.B ORIENTATION_BOTLEFT
roentgen b75cab
origin in bottom-left corner
roentgen b75cab
and
roentgen b75cab
.TP
roentgen b75cab
.B ORIENTATION_BOTRIGHT
roentgen b75cab
origin in bottom-right corner.
roentgen b75cab
.LP
roentgen b75cab
If you choose
roentgen b75cab
.B ORIENTATION_BOTLEFT
roentgen b75cab
result will be the same as returned by the
roentgen b75cab
.IR TIFFReadRGBAImage.
roentgen b75cab
.PP
roentgen b75cab
Raster pixels are 8-bit packed red, green, blue, alpha samples.
roentgen b75cab
The macros
roentgen b75cab
.IR TIFFGetR ,
roentgen b75cab
.IR TIFFGetG ,
roentgen b75cab
.IR TIFFGetB ,
roentgen b75cab
and
roentgen b75cab
.I TIFFGetA
roentgen b75cab
should be used to access individual samples.
roentgen b75cab
Images without Associated Alpha matting information have a constant
roentgen b75cab
Alpha of 1.0 (255).
roentgen b75cab
.PP
roentgen b75cab
.I TIFFReadRGBAImage
roentgen b75cab
converts non-8-bit images by scaling sample values.
roentgen b75cab
Palette, grayscale, bilevel, 
roentgen b75cab
.SM CMYK\c
roentgen b75cab
, and YCbCr images are converted to
roentgen b75cab
.SM RGB
roentgen b75cab
transparently.
roentgen b75cab
Raster pixels are returned uncorrected by any colorimetry information
roentgen b75cab
present in the directory.
roentgen b75cab
.PP
roentgen b75cab
The paramater
roentgen b75cab
.I stopOnError
roentgen b75cab
specifies how to act if an error is encountered while reading
roentgen b75cab
the image.
roentgen b75cab
If
roentgen b75cab
.I stopOnError
roentgen b75cab
is non-zero, then an error will terminate the operation; otherwise
roentgen b75cab
.I TIFFReadRGBAImage
roentgen b75cab
will continue processing data until all the possible data in the
roentgen b75cab
image have been requested.
roentgen b75cab
.SH NOTES
roentgen b75cab
In C++ the
roentgen b75cab
.I stopOnError
roentgen b75cab
parameter defaults to 0.
roentgen b75cab
.PP
roentgen b75cab
Samples must be either 1, 2, 4, 8, or 16 bits.
roentgen b75cab
Colorimetric samples/pixel must be either 1, 3, or 4 (i.e.
roentgen b75cab
.I SamplesPerPixel
roentgen b75cab
minus
roentgen b75cab
.IR ExtraSamples ).
roentgen b75cab
.PP
roentgen b75cab
Palettte image colormaps that appear to be incorrectly written
roentgen b75cab
as 8-bit values are automatically scaled to 16-bits.
roentgen b75cab
.PP
roentgen b75cab
.I TIFFReadRGBAImage
roentgen b75cab
is just a wrapper around the more general
roentgen b75cab
.IR TIFFRGBAImage (3TIFF)
roentgen b75cab
facilities.
roentgen b75cab
.SH "RETURN VALUES"
roentgen b75cab
1 is returned if the image was successfully read and converted.
roentgen b75cab
Otherwise, 0 is returned if an error was encountered and
roentgen b75cab
.I stopOnError
roentgen b75cab
is zero.
roentgen b75cab
.SH DIAGNOSTICS
roentgen b75cab
All error messages are directed to the
roentgen b75cab
.IR TIFFError (3TIFF)
roentgen b75cab
routine.
roentgen b75cab
.PP
roentgen b75cab
.BR "Sorry, can not handle %d-bit pictures" .
roentgen b75cab
The image had
roentgen b75cab
.I BitsPerSample
roentgen b75cab
other than 1, 2, 4, 8, or 16.
roentgen b75cab
.PP
roentgen b75cab
.BR "Sorry, can not handle %d-channel images" .
roentgen b75cab
The image had
roentgen b75cab
.I SamplesPerPixel
roentgen b75cab
other than 1, 3, or 4.
roentgen b75cab
.PP
roentgen b75cab
\fBMissing needed "PhotometricInterpretation" tag\fP.
roentgen b75cab
The image did not have a tag that describes how to display
roentgen b75cab
the data.
roentgen b75cab
.PP
roentgen b75cab
\fBNo "PhotometricInterpretation" tag, assuming RGB\fP.
roentgen b75cab
The image was missing a tag that describes how to display it,
roentgen b75cab
but because it has 3 or 4 samples/pixel, it is assumed to be
roentgen b75cab
.SM RGB.
roentgen b75cab
.PP
roentgen b75cab
\fBNo "PhotometricInterpretation" tag, assuming min-is-black\fP.
roentgen b75cab
The image was missing a tag that describes how to display it,
roentgen b75cab
but because it has 1 sample/pixel, it is assumed to be a grayscale
roentgen b75cab
or bilevel image.
roentgen b75cab
.PP
roentgen b75cab
.BR "No space for photometric conversion table" .
roentgen b75cab
There was insufficient memory for a table used to convert
roentgen b75cab
image samples to 8-bit
roentgen b75cab
.SM RGB.
roentgen b75cab
.PP
roentgen b75cab
\fBMissing required "Colormap" tag\fP.
roentgen b75cab
A Palette image did not have a required
roentgen b75cab
.I Colormap
roentgen b75cab
tag.
roentgen b75cab
.PP
roentgen b75cab
.BR "No space for tile buffer" .
roentgen b75cab
There was insufficient memory to allocate an i/o buffer.
roentgen b75cab
.PP
roentgen b75cab
.BR "No space for strip buffer" .
roentgen b75cab
There was insufficient memory to allocate an i/o buffer.
roentgen b75cab
.PP
roentgen b75cab
.BR "Can not handle format" .
roentgen b75cab
The image has a format (combination of
roentgen b75cab
.IR BitsPerSample ,
roentgen b75cab
.IR SamplesPerPixel ,
roentgen b75cab
and
roentgen b75cab
.IR PhotometricInterpretation )
roentgen b75cab
that
roentgen b75cab
.I TIFFReadRGBAImage
roentgen b75cab
can not handle.
roentgen b75cab
.PP
roentgen b75cab
.BR "No space for B&W mapping table" .
roentgen b75cab
There was insufficient memory to allocate a table used to map
roentgen b75cab
grayscale data to
roentgen b75cab
.SM RGB.
roentgen b75cab
.PP
roentgen b75cab
.BR "No space for Palette mapping table" .
roentgen b75cab
There was insufficient memory to allocate a table used to map
roentgen b75cab
data to 8-bit
roentgen b75cab
.SM RGB.
roentgen b75cab
.SH "SEE ALSO"
roentgen b75cab
.BR TIFFOpen (3TIFF),
roentgen b75cab
.BR TIFFRGBAImage (3TIFF),
roentgen b75cab
.BR TIFFReadRGBAStrip (3TIFF),
roentgen b75cab
.BR TIFFReadRGBATile (3TIFF),
roentgen b75cab
.BR libtiff (3TIFF)
roentgen b75cab
.PP
roentgen b75cab
Libtiff library home page:
roentgen b75cab
.BR http://www.remotesensing.org/libtiff/