Blame html/man/TIFFOpen.3tiff.html

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
<html>
Packit Service 2594b8
<head>
Packit Service 2594b8
<meta name="generator" content="groff -Thtml, see www.gnu.org">
Packit Service 2594b8
<meta name="Content-Style" content="text/css">
Packit Service 2594b8
<title>TIFFOpen</title>
Packit Service 2594b8
</head>
Packit Service 2594b8
<body>
Packit Service 2594b8
Packit Service 2594b8

TIFFOpen

Packit Service 2594b8
NAME
Packit Service 2594b8
SYNOPSIS
Packit Service 2594b8
DESCRIPTION
Packit Service 2594b8
OPTIONS
Packit Service 2594b8
BYTE ORDER
Packit Service 2594b8
RETURN VALUES
Packit Service 2594b8
DIAGNOSTICS
Packit Service 2594b8
SEE ALSO
Packit Service 2594b8
Packit Service 2594b8

Packit Service 2594b8
Packit Service 2594b8

NAME

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
       cols="2" cellspacing="0" cellpadding="0">
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

TIFFOpen, TIFFFdOpen, TIFFClientOpen − open a

Packit Service 2594b8
<small>TIFF</small> file for reading or writing

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

SYNOPSIS

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
       cols="2" cellspacing="0" cellpadding="0">
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

#include <tiffio.h>

Packit Service 2594b8
Packit Service 2594b8

TIFF* TIFFOpen(const char *filename,

Packit Service 2594b8
const char *mode)
Packit Service 2594b8
TIFF* TIFFFdOpen(const int fd, const char
Packit Service 2594b8
*filename, const char
Packit Service 2594b8
*mode)

Packit Service 2594b8
Packit Service 2594b8

typedef tsize_t (*TIFFReadWriteProc)(thandle_t,

Packit Service 2594b8
tdata_t, tsize_t);
Packit Service 2594b8
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
Packit Service 2594b8
typedef int (*TIFFCloseProc)(thandle_t);
Packit Service 2594b8
typedef toff_t (*TIFFSizeProc)(thandle_t);
Packit Service 2594b8
typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*,
Packit Service 2594b8
toff_t*);
Packit Service 2594b8
typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t,
Packit Service 2594b8
toff_t);

Packit Service 2594b8
Packit Service 2594b8

TIFF* TIFFClientOpen(const char

Packit Service 2594b8
*filename, const char *mode,
Packit Service 2594b8
thandle_t clientdata, TIFFReadWriteProc
Packit Service 2594b8
readproc, TIFFReadWriteProc
Packit Service 2594b8
writeproc, TIFFSeekProc seekproc,
Packit Service 2594b8
TIFFCloseProc closeproc, TIFFSizeProc
Packit Service 2594b8
sizeproc, TIFFMapFileProc mapproc,
Packit Service 2594b8
TIFFUnmapFileProc unmapproc)

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

DESCRIPTION

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
       cols="2" cellspacing="0" cellpadding="0">
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

TIFFOpen opens a <small>TIFF</small> file whose

Packit Service 2594b8
name is filename and returns a handle to be used in
Packit Service 2594b8
subsequent calls to routines in libtiff. If the open
Packit Service 2594b8
operation fails, then zero is returned. The mode
Packit Service 2594b8
parameter specifies if the file is to be opened for reading
Packit Service 2594b8
(‘‘r’’), writing
Packit Service 2594b8
(‘‘w’’), or appending
Packit Service 2594b8
(‘‘a’’) and, optionally, whether to
Packit Service 2594b8
override certain default aspects of library operation (see
Packit Service 2594b8
below). When a file is opened for appending, existing data
Packit Service 2594b8
will not be touched; instead new data will be written as
Packit Service 2594b8
additional subfiles. If an existing file is opened for
Packit Service 2594b8
writing, all previous data is overwritten.

Packit Service 2594b8
Packit Service 2594b8

If a file is opened for reading, the first

Packit Service 2594b8
<small>TIFF</small> directory in the file is automatically
Packit Service 2594b8
read (also see TIFFSetDirectory(3TIFF) for reading
Packit Service 2594b8
directories other than the first). If a file is opened for
Packit Service 2594b8
writing or appending, a default directory is automatically
Packit Service 2594b8
created for writing subsequent data. This directory has all
Packit Service 2594b8
the default values specified in <small>TIFF</small> Revision
Packit Service 2594b8
6.0: BitsPerSample=1, ThreshHolding=bilevel
Packit Service 2594b8
art scan, FillOrder=1 (most significant bit of each
Packit Service 2594b8
data byte is filled first), Orientation=1 (the 0th
Packit Service 2594b8
row represents the visual top of the image, and the 0th
Packit Service 2594b8
column represents the visual left hand side),
Packit Service 2594b8
SamplesPerPixel=1, RowsPerStrip=infinity,
Packit Service 2594b8
ResolutionUnit=2 (inches), and Compression=1
Packit Service 2594b8
(no compression). To alter these values, or to define values
Packit Service 2594b8
for additional fields, TIFFSetField(3TIFF) must be
Packit Service 2594b8
used.

Packit Service 2594b8
Packit Service 2594b8

TIFFFdOpen is like TIFFOpen except that it

Packit Service 2594b8
opens a <small>TIFF</small> file given an open file
Packit Service 2594b8
descriptor fd. The file’s name and mode must
Packit Service 2594b8
reflect that of the open descriptor. The object associated
Packit Service 2594b8
with the file descriptor must support random
Packit Service 2594b8
access.

Packit Service 2594b8
Packit Service 2594b8

TIFFClientOpen is like TIFFOpen except that

Packit Service 2594b8
the caller supplies a collection of functions that the
Packit Service 2594b8
library will use to do <small>UNIX</small> -like I/O
Packit Service 2594b8
operations. The readproc and writeproc are
Packit Service 2594b8
called to read and write data at the current file position.
Packit Service 2594b8
seekproc is called to change the current file
Packit Service 2594b8
position a la lseek(2). closeproc is invoked
Packit Service 2594b8
to release any resources associated with an open file.
Packit Service 2594b8
sizeproc is invoked to obtain the size in bytes of a
Packit Service 2594b8
file. mapproc and unmapproc are called to map
Packit Service 2594b8
and unmap a file’s contents in memory; c.f.
Packit Service 2594b8
mmap(2) and munmap(2). The clientdata
Packit Service 2594b8
parameter is an opaque ‘‘handle’’
Packit Service 2594b8
passed to the client-specified routines passed as parameters
Packit Service 2594b8
to TIFFClientOpen.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

OPTIONS

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
       cols="2" cellspacing="0" cellpadding="0">
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

The open mode parameter can include the following flags

Packit Service 2594b8
in addition to the ‘‘r’’,
Packit Service 2594b8
‘‘w’’, and
Packit Service 2594b8
‘‘a’’ flags. Note however that
Packit Service 2594b8
option flags must follow the read-write-append
Packit Service 2594b8
specification.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
       cols="5" cellspacing="0" cellpadding="0">
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

l

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

When creating a new file force information be written

Packit Service 2594b8
with Little-Endian byte order (but see below). By default
Packit Service 2594b8
the library will create new files using the native
Packit Service 2594b8
<small>CPU</small> byte order.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

b

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

When creating a new file force information be written

Packit Service 2594b8
with Big-Endian byte order (but see below). By default the
Packit Service 2594b8
library will create new files using the native
Packit Service 2594b8
<small>CPU</small> byte order.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

L

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Force image data that is read or written to be treated

Packit Service 2594b8
with bits filled from Least Significant Bit (
Packit Service 2594b8
<small>LSB</small> ) to Most Significant Bit (
Packit Service 2594b8
<small>MSB</small> ). Note that this is the opposite to the
Packit Service 2594b8
way the library has worked from its inception.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

B

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Force image data that is read or written to be treated

Packit Service 2594b8
with bits filled from Most Significant Bit (
Packit Service 2594b8
<small>MSB</small> ) to Least Significant Bit (
Packit Service 2594b8
<small>LSB</small> ); this is the default.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

H

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Force image data that is read or written to be treated

Packit Service 2594b8
with bits filled in the same order as the native
Packit Service 2594b8
<small>CPU.</small>

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

M

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Enable the use of memory-mapped files for images opened

Packit Service 2594b8
read-only. If the underlying system does not support
Packit Service 2594b8
memory-mapped files or if the specific image being opened
Packit Service 2594b8
cannot be memory-mapped then the library will fallback to
Packit Service 2594b8
using the normal system interface for reading information.
Packit Service 2594b8
By default the library will attempt to use memory-mapped
Packit Service 2594b8
files.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

m

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Disable the use of memory-mapped files.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

C

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Enable the use of ‘‘strip

Packit Service 2594b8
chopping’’ when reading images that are
Packit Service 2594b8
comprised of a single strip or tile of uncompressed data.
Packit Service 2594b8
Strip chopping is a mechanism by which the library will
Packit Service 2594b8
automatically convert the single-strip image to multiple
Packit Service 2594b8
strips, each of which has about 8 Kilobytes of data. This
Packit Service 2594b8
facility can be useful in reducing the amount of memory used
Packit Service 2594b8
to read an image because the library normally reads each
Packit Service 2594b8
strip in its entirety. Strip chopping does however alter the
Packit Service 2594b8
apparent contents of the image because when an image is
Packit Service 2594b8
divided into multiple strips it looks as though the
Packit Service 2594b8
underlying file contains multiple separate strips. Finally,
Packit Service 2594b8
note that default handling of strip chopping is a
Packit Service 2594b8
compile-time configuration parameter. The default behaviour,
Packit Service 2594b8
for backwards compatibility, is to enable strip
Packit Service 2594b8
chopping.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

c

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Disable the use of strip chopping when reading

Packit Service 2594b8
images.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

h

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Read TIFF header only, do not load the first image

Packit Service 2594b8
directory. That could be useful in case of the broken first
Packit Service 2594b8
directory. We can open the file and proceed to the other
Packit Service 2594b8
directories.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

BYTE ORDER

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
       cols="2" cellspacing="0" cellpadding="0">
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

The <small>TIFF</small> specification (all

Packit Service 2594b8
versions) states that compliant readers must be
Packit Service 2594b8
capable of reading images written in either byte order.
Packit Service 2594b8
Nonetheless some software that claims to support the reading
Packit Service 2594b8
of <small>TIFF</small> images is incapable of reading images
Packit Service 2594b8
in anything but the native <small>CPU</small> byte order on
Packit Service 2594b8
which the software was written. (Especially notorious are
Packit Service 2594b8
applications written to run on Intel-based machines.) By
Packit Service 2594b8
default the library will create new files with the native
Packit Service 2594b8
byte-order of the <small>CPU</small> on which the
Packit Service 2594b8
application is run. This ensures optimal performance and is
Packit Service 2594b8
portable to any application that conforms to the TIFF
Packit Service 2594b8
specification. To force the library to use a specific
Packit Service 2594b8
byte-order when creating a new file the
Packit Service 2594b8
‘‘b’’ and
Packit Service 2594b8
‘‘l’’ option flags may be included
Packit Service 2594b8
in the call to open a file; for example,
Packit Service 2594b8
‘‘wb’’ or
Packit Service 2594b8
‘‘wl’’.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

RETURN VALUES

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
       cols="2" cellspacing="0" cellpadding="0">
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Upon successful completion TIFFOpen,

Packit Service 2594b8
TIFFFdOpen, and TIFFClientOpen return a
Packit Service 2594b8
<small>TIFF</small> pointer. Otherwise, NULL is
Packit Service 2594b8
returned.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

DIAGNOSTICS

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
       cols="2" cellspacing="0" cellpadding="0">
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

All error messages are directed to the

Packit Service 2594b8
TIFFError(3TIFF) routine. Likewise, warning messages
Packit Service 2594b8
are directed to the TIFFWarning(3TIFF) routine.

Packit Service 2594b8
Packit Service 2594b8

"%s": Bad mode. The specified

Packit Service 2594b8
mode parameter was not one of
Packit Service 2594b8
‘‘r’’ (read),
Packit Service 2594b8
‘‘w’’ (write), or
Packit Service 2594b8
‘‘a’’ (append).

Packit Service 2594b8
Packit Service 2594b8

%s: Cannot open. TIFFOpen() was unable to

Packit Service 2594b8
open the specified filename for read/writing.

Packit Service 2594b8
Packit Service 2594b8

Cannot read TIFF header. An error occurred while

Packit Service 2594b8
attempting to read the header information.

Packit Service 2594b8
Packit Service 2594b8

Error writing TIFF header. An error occurred while

Packit Service 2594b8
writing the default header information for a new file.

Packit Service 2594b8
Packit Service 2594b8

Not a TIFF file, bad magic number %d (0x%x). The

Packit Service 2594b8
magic number in the header was not (hex) 0x4d4d or (hex)
Packit Service 2594b8
0x4949.

Packit Service 2594b8
Packit Service 2594b8

Not a TIFF file, bad version number %d (0x%x). The

Packit Service 2594b8
version field in the header was not 42 (decimal).

Packit Service 2594b8
Packit Service 2594b8

Cannot append to file that has opposite byte

Packit Service 2594b8
ordering. A file with a byte ordering opposite to the
Packit Service 2594b8
native byte ordering of the current machine was opened for
Packit Service 2594b8
appending (‘‘a’’). This is a
Packit Service 2594b8
limitation of the library.

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

SEE ALSO

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
       cols="2" cellspacing="0" cellpadding="0">
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

libtiff(3TIFF), TIFFClose(3TIFF)

Packit Service 2594b8
Packit Service 2594b8
Packit Service 2594b8

Packit Service 2594b8
</body>
Packit Service 2594b8
</html>