| 1 |
TIFFReadRGBAStrip |
| 2 |
================= |
| 3 |
|
| 4 |
Synopsis |
| 5 |
-------- |
| 6 |
|
| 7 |
.. highlight:: c |
| 8 |
|
| 9 |
:: |
| 10 |
|
| 11 |
#include <tiffio.h> |
| 12 |
|
| 13 |
.. c:function:: int TIFFReadRGBAStrip(TIFF* tif, uint32_t row, uint32_t* raster) |
| 14 |
|
| 15 |
.. c:function:: int TIFFReadRGBAStripExt(TIFF* tif, uint32_t row, uint32_t * raster, int stop_on_error) |
| 16 |
|
| 17 |
Description |
| 18 |
----------- |
| 19 |
|
| 20 |
:c:func:`TIFFReadRGBAStrip` reads a single strip of a strip-based image |
| 21 |
into memory, storing the result in the user supplied RGBA *raster*. |
| 22 |
The raster is assumed to be an array of ``ImageWidth`` × ``RowsPerStrip`` |
| 23 |
32-bit entries, where ``ImageWidth`` is the width of the image |
| 24 |
(:c:macro:`TIFFTAG_IMAGEWIDTH`) and ``RowsPerStrip`` is the maximum lines |
| 25 |
in a strip (:c:macro:`TIFFTAG_ROWSPERSTRIP`). |
| 26 |
|
| 27 |
:c:func:`TIFFReadRGBAStripExt` provides the paramater `stop_on_error`. |
| 28 |
Its behaviour is described at :doc:`TIFFReadRGBAImage`. |
| 29 |
|
| 30 |
The *row* value should be the row of the first row in the strip |
| 31 |
(*strip* × ``RowsPerStrip``, zero based). |
| 32 |
|
| 33 |
Note that the raster is assume to be organized such that the pixel at location |
| 34 |
(*x*, *y*) is *raster* [ *y* × *width* + *x* ]; with the raster origin in the |
| 35 |
*lower-left hand corner* of the strip. That is bottom to top organization. |
| 36 |
When reading a partial last strip in the file the last line of the image will |
| 37 |
begin at the beginning of the buffer. |
| 38 |
|
| 39 |
Raster pixels are 8-bit packed red, green, blue, alpha samples. The macros |
| 40 |
:c:macro:`TIFFGetR`, :c:macro:`TIFFGetG`, :c:macro:`TIFFGetB`, and |
| 41 |
:c:macro:`TIFFGetA` should be used to access individual samples. Images |
| 42 |
without Associated Alpha matting information have a constant Alpha of 1.0 |
| 43 |
(255). |
| 44 |
|
| 45 |
See the :doc:`TIFFRGBAImage` page for more details on how various image types |
| 46 |
are converted to RGBA values. |
| 47 |
|
| 48 |
Notes |
| 49 |
----- |
| 50 |
|
| 51 |
Samples must be either 1, 2, 4, 8, or 16 bits. |
| 52 |
Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. ``SamplesPerPixel`` |
| 53 |
- ``ExtraSamples``). |
| 54 |
|
| 55 |
Palette image colormaps that appear to be incorrectly written as 8-bit values |
| 56 |
are automatically scaled to 16-bits. |
| 57 |
|
| 58 |
:c:func:`TIFFReadRGBAStrip` is just a wrapper around the more general |
| 59 |
:doc:`TIFFRGBAImage` facilities. It's main advantage over the similar |
| 60 |
:c:func:`TIFFReadRGBAImage` function is that for large images a single |
| 61 |
buffer capable of holding the whole image doesn't need to be allocated, |
| 62 |
only enough for one strip. The :c:func:`TIFFReadRGBATile` function |
| 63 |
does a similar operation for tiled images. |
| 64 |
|
| 65 |
Return values |
| 66 |
------------- |
| 67 |
|
| 68 |
1 is returned if the image was successfully read and converted. |
| 69 |
Otherwise, 0 is returned if an error was encountered. |
| 70 |
|
| 71 |
Diagnostics |
| 72 |
----------- |
| 73 |
|
| 74 |
All error messages are directed to the :c:func:`TIFFErrorExtR` routine. |
| 75 |
|
| 76 |
``"Sorry, can not handle %d-bit pictures"``: |
| 77 |
|
| 78 |
The image had ``BitsPerSample`` other than 1, 2, 4, 8, or 16. |
| 79 |
|
| 80 |
``"Sorry, can not handle %d-channel images"``: |
| 81 |
|
| 82 |
The image had ``SamplesPerPixel`` other than 1, 3, or 4. |
| 83 |
|
| 84 |
``Missing needed "PhotometricInterpretation" tag``: |
| 85 |
|
| 86 |
The image did not have a tag that describes how to display the data. |
| 87 |
|
| 88 |
``No "PhotometricInterpretation" tag, assuming RGB``: |
| 89 |
|
| 90 |
The image was missing a tag that describes how to display it, but because it |
| 91 |
has 3 or 4 samples/pixel, it is assumed to be RGB. |
| 92 |
|
| 93 |
``No "PhotometricInterpretation" tag, assuming min-is-black\fP``: |
| 94 |
|
| 95 |
The image was missing a tag that describes how to display it, but |
| 96 |
because it has 1 sample/pixel, it is assumed to be a grayscale or |
| 97 |
bilevel image. |
| 98 |
|
| 99 |
``"No space for photometric conversion table"``: |
| 100 |
|
| 101 |
There was insufficient memory for a table used to convert image samples to |
| 102 |
8-bit RGB. |
| 103 |
|
| 104 |
``Missing required "Colormap" tag``: |
| 105 |
|
| 106 |
A Palette image did not have a required ``Colormap`` tag. |
| 107 |
|
| 108 |
``"No space for tile buffer"``: |
| 109 |
|
| 110 |
There was insufficient memory to allocate an i/o buffer. |
| 111 |
|
| 112 |
``"No space for strip buffer"``: |
| 113 |
|
| 114 |
There was insufficient memory to allocate an i/o buffer. |
| 115 |
|
| 116 |
``"Can not handle format"``: |
| 117 |
|
| 118 |
The image has a format (combination of ``BitsPerSample``, |
| 119 |
``SamplesPerPixel``, and ``PhotometricInterpretation``) |
| 120 |
that :c:func:`TIFFReadRGBAImage` can not handle. |
| 121 |
|
| 122 |
``"No space for B&W mapping table"``: |
| 123 |
|
| 124 |
There was insufficient memory to allocate a table used to map grayscale data |
| 125 |
to RGB. |
| 126 |
|
| 127 |
``"No space for Palette mapping table"``: |
| 128 |
|
| 129 |
There was insufficient memory to allocate a table used to map data to 8-bit |
| 130 |
RGB. |
| 131 |
|
| 132 |
See also |
| 133 |
-------- |
| 134 |
|
| 135 |
:doc:`TIFFOpen` (3tiff), |
| 136 |
:doc:`TIFFRGBAImage` (3tiff), |
| 137 |
:doc:`TIFFReadRGBAImage` (3tiff), |
| 138 |
:doc:`TIFFReadRGBATile` (3tiff), |
| 139 |
:doc:`libtiff` (3tiff) |