Blame man/TIFFReadRGBAImage.3tiff

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