TIFFWRITESCANLINE(3tiff) | LibTIFF | TIFFWRITESCANLINE(3tiff) |
TIFFWriteScanline - write a scanline to an open TIFF file
#include <tiffio.h>
Write data to a file at the specified row. The sample parameter is used only if data are organized in separate planes (PlanarConfiguration = 2). The data are assumed to be uncompressed and in the native bit- and byte-order of the host machine. The data written to the file is compressed according to the compression scheme of the current TIFF directory (see further below). If the current scanline is past the end of the current subfile, the ImageLength field is automatically increased to include the scanline (except for PlanarConfiguration = 2, where the ImageLength cannot be changed once the first data are written). If the ImageLength is increased, the StripOffsets and StripByteCounts fields are similarly enlarged to reflect data written past the previous end of image.
The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with BitsPerSample greater than 8. The library attempts to hide bit-ordering differences between the image and the native machine by converting data from the native machine order.
In C++ the sample parameter defaults to 0.
Once data are written to a file for the current directory, the values of certain tags may not be altered; see TIFFSetField() for more information.
It is not possible to write scanlines to a file that uses a tiled organization. The routine TIFFIsTiled() can be used to determine if the file is organized as tiles or strips.
TIFFWriteScanline() returns -1 if it immediately detects an error and 1 for a successful write.
All error messages are directed to the TIFFErrorExtR() routine.
%s: File not open for writing:
"Can not write scanlines to a tiled image":
"Compression algorithm does not support random access":
%s: Must set "ImageWidth" before writing data:
%s: Must set "PlanarConfiguration" before writing data:
Can not change "ImageLength" when using separate planes:
"%d: Sample out of range, max %d":
%s: No space for strip arrays:
Writing subsampled YCbCR data does not work correctly because, for PlanarConfiguration = 2 the size of a scanline is not calculated on a per-sample basis, and for PlanarConfiguration = 1 the library does not pack the block-interleaved samples.
TIFFOpen (3tiff), TIFFWriteEncodedStrip (3tiff), TIFFWriteRawStrip (3tiff), libtiff (3tiff)
LibTIFF contributors
1988-2023, LibTIFF contributors
November 23, 2023 | 4.5 |