Blame man/TIFFWriteScanline.3tiff

Packit 7838c8
.\" $Id: TIFFWriteScanline.3tiff,v 1.3 2016-09-25 20:05:50 bfriesen Exp $
Packit 7838c8
.\"
Packit 7838c8
.\" Copyright (c) 1988-1997 Sam Leffler
Packit 7838c8
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
Packit 7838c8
.\"
Packit 7838c8
.\" Permission to use, copy, modify, distribute, and sell this software and 
Packit 7838c8
.\" its documentation for any purpose is hereby granted without fee, provided
Packit 7838c8
.\" that (i) the above copyright notices and this permission notice appear in
Packit 7838c8
.\" all copies of the software and related documentation, and (ii) the names of
Packit 7838c8
.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
Packit 7838c8
.\" publicity relating to the software without the specific, prior written
Packit 7838c8
.\" permission of Sam Leffler and Silicon Graphics.
Packit 7838c8
.\" 
Packit 7838c8
.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
Packit 7838c8
.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
Packit 7838c8
.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
Packit 7838c8
.\" 
Packit 7838c8
.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
Packit 7838c8
.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
Packit 7838c8
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
Packit 7838c8
.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
Packit 7838c8
.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
Packit 7838c8
.\" OF THIS SOFTWARE.
Packit 7838c8
.\"
Packit 7838c8
.if n .po 0
Packit 7838c8
.TH TIFFWriteScanline 3TIFF "December 16, 1991" "libtiff"
Packit 7838c8
.SH NAME
Packit 7838c8
TIFFWriteScanline \- write a scanline to an open
Packit 7838c8
.SM TIFF
Packit 7838c8
file
Packit 7838c8
.SH SYNOPSIS
Packit 7838c8
.B "#include <tiffio.h>"
Packit 7838c8
.sp
Packit 7838c8
.BI "int TIFFWriteScanline(TIFF *" tif ", tdata_t " buf ", uint32 " row ", tsample_t " sample ")"
Packit 7838c8
.SH DESCRIPTION
Packit 7838c8
Write data to a file at the specified row. The
Packit 7838c8
.I sample
Packit 7838c8
parameter is used only if data are organized in separate planes (\c
Packit 7838c8
.IR PlanarConfiguration =2).
Packit 7838c8
The data are assumed to be uncompressed and in the native bit- and byte-order
Packit 7838c8
of the host machine. The data written to the file is compressed according to
Packit 7838c8
the compression scheme of the current
Packit 7838c8
.SM TIFF
Packit 7838c8
directory (see further below). If the current scanline is past the end of the
Packit 7838c8
current subfile, the
Packit 7838c8
.I ImageLength
Packit 7838c8
field is automatically increased to include the scanline (except
Packit 7838c8
for
Packit 7838c8
.IR PlanarConfiguration =2,
Packit 7838c8
where the
Packit 7838c8
.I ImageLength
Packit 7838c8
cannot be changed once the first data are written). If the
Packit 7838c8
.I ImageLength
Packit 7838c8
is increased, the
Packit 7838c8
.I StripOffsets
Packit 7838c8
and
Packit 7838c8
.I StripByteCounts
Packit 7838c8
fields are similarly enlarged to reflect data written past the previous end of
Packit 7838c8
image.
Packit 7838c8
.SH NOTES
Packit 7838c8
The library writes encoded data using the native machine byte order. Correctly
Packit 7838c8
implemented
Packit 7838c8
.SM TIFF
Packit 7838c8
readers are expected to do any necessary byte-swapping to correctly process
Packit 7838c8
image data with BitsPerSample greater than 8. The library attempts to hide
Packit 7838c8
bit-ordering differences between the image and the native machine by
Packit 7838c8
converting data from the native machine order.
Packit 7838c8
.PP
Packit 7838c8
In C++ the
Packit 7838c8
.I sample
Packit 7838c8
parameter defaults to 0.
Packit 7838c8
.PP
Packit 7838c8
Once data are written to a file for the current directory, the values of
Packit 7838c8
certain tags may not be altered; see
Packit 7838c8
.IR TIFFSetField (3TIFF)
Packit 7838c8
for more information.
Packit 7838c8
.PP
Packit 7838c8
It is not possible to write scanlines to a file that uses a tiled
Packit 7838c8
organization.  The routine
Packit 7838c8
.IR TIFFIsTiled
Packit 7838c8
can be used to determine if the file is organized as tiles or strips.
Packit 7838c8
.SH "RETURN VALUES"
Packit 7838c8
.IR TIFFWriteScanline
Packit 7838c8
returns \-1 if it immediately detects an error and 1 for a successful write.
Packit 7838c8
.SH DIAGNOSTICS
Packit 7838c8
All error messages are directed to the
Packit 7838c8
.IR TIFFError (3TIFF)
Packit 7838c8
routine.
Packit 7838c8
.PP
Packit 7838c8
.BR "%s: File not open for writing .
Packit 7838c8
The file was opened for reading, not writing.
Packit 7838c8
.PP
Packit 7838c8
.BR "Can not write scanlines to a tiled image" .
Packit 7838c8
An attempt was made to write a scanline to a tiled image. The image is assumed
Packit 7838c8
to be organized in tiles because the
Packit 7838c8
.I TileWidth
Packit 7838c8
and
Packit 7838c8
.I TileLength
Packit 7838c8
tags have been set with
Packit 7838c8
.IR TIFFSetField (3TIFF).
Packit 7838c8
.PP
Packit 7838c8
.BR "Compression algorithm does not support random access" .
Packit 7838c8
Data was written in a non-sequential order to a file that uses a compression
Packit 7838c8
algorithm and that has
Packit 7838c8
.I RowsPerStrip
Packit 7838c8
greater than one. That is, data in the image is to be stored in a compressed
Packit 7838c8
form, and with multiple rows packed into a strip. In this case, the library
Packit 7838c8
does not support random access to the data. The data should either be written
Packit 7838c8
as entire strips, sequentially by rows, or the value of
Packit 7838c8
.I RowsPerStrip
Packit 7838c8
should be set to one.
Packit 7838c8
.PP
Packit 7838c8
\fB%s: Must set "ImageWidth" before writing data\fP.
Packit 7838c8
The image's width has not be set before the first write.
Packit 7838c8
See
Packit 7838c8
.BR TIFFSetField (3TIFF)
Packit 7838c8
for information on how to do this.
Packit 7838c8
.PP
Packit 7838c8
\fB%s: Must set "PlanarConfiguration" before writing data\fP.
Packit 7838c8
The organization of data has not be defined before the first write.
Packit 7838c8
See
Packit 7838c8
.BR TIFFSetField (3TIFF)
Packit 7838c8
for information on how to do this.
Packit 7838c8
.PP
Packit 7838c8
\fBCan not change "ImageLength" when using separate planes\fP. Separate image
Packit 7838c8
planes are being used (\c
Packit 7838c8
.IR PlanarConfiguration =2),
Packit 7838c8
but the number of rows has not been specified before the first write. The
Packit 7838c8
library supports the dynamic growth of an image only when data are organized
Packit 7838c8
in a contiguous manner (\c
Packit 7838c8
.IR PlanarConfiguration =1).
Packit 7838c8
.PP
Packit 7838c8
.BR "%d: Sample out of range, max %d" .
Packit 7838c8
The
Packit 7838c8
.I sample
Packit 7838c8
parameter was greater than the value of the SamplesPerPixel tag.
Packit 7838c8
.PP
Packit 7838c8
.BR "%s: No space for strip arrays .
Packit 7838c8
There was not enough space for the arrays that hold strip offsets and byte
Packit 7838c8
counts.
Packit 7838c8
.SH BUGS
Packit 7838c8
Writing subsampled YCbCR data does not work correctly because, for 
Packit 7838c8
.IR PlanarConfiguration =2
Packit 7838c8
the size of a scanline is not calculated on a per-sample basis, and for
Packit 7838c8
.IR PlanarConfiguration =1
Packit 7838c8
the library does not pack the block-interleaved samples.
Packit 7838c8
.SH "SEE ALSO"
Packit 7838c8
.BR TIFFOpen (3TIFF),
Packit 7838c8
.BR TIFFWriteEncodedStrip (3TIFF),
Packit 7838c8
.BR TIFFWriteRawStrip (3TIFF),
Packit 7838c8
.BR libtiff (3TIFF)
Packit 7838c8
.PP
Packit 7838c8
Libtiff library home page:
Packit 7838c8
.BR http://www.simplesystems.org/libtiff/