Blame man/TIFFReadRGBAImage.3tiff

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