TIFFWRITESCANLINE(3tiff)
π TIFFWRITESCANLINE π
okay bestie, welcome to the TIFFWriteScanline(3tiff) page β this is the LibTIFF girlies' guide to yeeting one whole scanline into an open TIFF file. it's giving "one row at a time, no cap." π¦
β¨ NAME β¨
TIFFWriteScanline β write a scanline to an open TIFF file. that's it, that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <tiffio.h>
int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row, uint16_t sample)
π DESCRIPTION π
so like, you're writing data to a file at the row you specify. slay. β¨
the sample parameter? it's only used if your data are organized in separate planes, aka PlanarConfiguration = 2. otherwise it's just sitting there being decorative, ngl.
the data you hand over are assumed to be uncompressed and in the native bit- and byte-order of the host machine. the library then does the glow-up: whatever gets written to the file is compressed according to the compression scheme of the current TIFF directory (more on that below, keep reading π«Ά).
and here's the cute part: if the current scanline is past the end of the current subfile, the ImageLength field gets automatically increased to include the scanline. the exception is PlanarConfiguration = 2, where ImageLength cannot be changed once the first data are written. periodt. π«
and if ImageLength gets increased, the StripOffsets and StripByteCounts fields get similarly enlarged to reflect the data written past the previous end of image. iconic behavior honestly. π
π§ NOTES π§
- 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
BitsPerSamplegreater than8. it's a whole teamwork moment. π€ - 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
sampleparameter defaults to0. π« - 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. no take-backsies, bestie. π - 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. check before you commit, fr fr. π
π RETURN VALUES π
TIFFWriteScanline() returns -1 if it immediately detects an error, and 1 for a successful write. that's the whole range, she's simple like that. β¨
π DIAGNOSTICS π
all error messages are directed to the TIFFErrorExtR() routine. so when things go sideways, that's who's telling you. π
%s: File not open for writing:the file was opened for reading, not writing. like girl, you can't write to something you opened read-only. π"Can not write scanlines to a tiled image":an attempt was made to write a scanline to a tiled image. the image is assumed to be organized in tiles because theTileWidthandTileLengthtags have been set withTIFFSetField()."Compression algorithm does not support random access":data was written in a non-sequential order to a file that uses a compression algorithm and that hasRowsPerStripgreater than one. that is, data in the image is to be stored in a compressed form, and with multiple rows packed into a strip. in this case, the library does not support random access to the data. the data should either be written as entire strips, sequentially by rows, or the value ofRowsPerStripshould be set to one. pick a lane bestie. π£οΈ%s: Must set "ImageWidth" before writing data:the image's width has not be set before the first write. seeTIFFSetField()for information on how to do this.%s: Must set "PlanarConfiguration" before writing data:the organization of data has not be defined before the first write. seeTIFFSetField()for information on how to do this.Can not change "ImageLength" when using separate planes:separate image planes are being used (PlanarConfiguration = 2), but the number of rows has not been specified before the first write. the library supports the dynamic growth of an image only when data are organized in a contiguous manner (PlanarConfiguration = 1)."%d: Sample out of range, max %d":thesampleparameter was greater than the value of theSamplesPerPixeltag.%s: No space for strip arrays:there was not enough space for the arrays that hold strip offsets and byte counts. π
π¦ BUGS π¦
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. so yeah, that one's cursed, be aware. π
β SEE ALSO β
TIFFOpen(3tiff)TIFFWriteEncodedStrip(3tiff)TIFFWriteRawStrip(3tiff)libtiff(3tiff)
π AUTHOR π
LibTIFF contributors π
πΈ COPYRIGHT πΈ
1988-2025, LibTIFF contributors
and that's the tea, bestie π β this was LibTIFF 4.7, dated Jun 27, 2026, and honestly? she ate. go write those scanlines, you've got this. π β¨π
π¦ where this page comes from
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms