TIFFOpen(3T)      MISC. REFERENCE MANUAL PAGES       TIFFOpen(3T)

NAME
     TIFFOpen, TIFFFdOpen, TIFFClientOpen - open a TIFF file  for
     reading or writing

SYNOPSIS
     #include <tiffio.h>
     TIFF* TIFFOpen(const char* filename, const char* mode)

     TIFF* TIFFFdOpen(const int fd, const char* filename, const char* mode)
     typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
     typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
     typedef int (*TIFFCloseProc)(thandle_t);
     typedef toff_t (*TIFFSizeProc)(thandle_t);
     typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
     typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);

     TIFF* TIFFClientOpen(const char* filename, const char* mode, thandle_t clientdata,
         TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, TIFFSeekProc seekproc,
         TIFFCloseProc closeproc, TIFFSizeProc sizeproc, TIFFMapFileProc mapproc,
         TIFFUnmapFileProc unmapproc)

DESCRIPTION
     TIFFOpen opens a  TIFF  file  whose  name  is  filename  and
     returns  a handle to be used in subsequent calls to routines
     in libtiff.  If the  open  operation  fails,  then  zero  is
     returned.  The mode parameter specifies if the file is to be
     opened for reading (``r''), writing  (``w''),  or  appending
     (``a'').  When a file is opened for appending, existing data
     will not be touched; instead new data  will  be  written  as
     additional  subfiles.   If  an  existing  file is opened for
     writing, all previous data is overwritten.

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

     It is not possible to append data to a file that has a  byte
     ordering  opposite to the native byte ordering of a machine.
     That is, for example, the library will not allow a file with
     little-endian  byte  ordering to be appended to on a machine
     that has a native big-endian byte ordering.

Sun Release 4.1  Last change: February 14, 1992                 1

TIFFOpen(3T)      MISC. REFERENCE MANUAL PAGES       TIFFOpen(3T)

     TIFFFdOpen is like TIFFOpen except that it opens a TIFF file
     given  an open file descriptor fd.  The file's name and mode
     must reflect that of the open descriptor.  The object  asso-
     ciated with the file descriptor must support random access.

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

RETURN VALUES
     Upon  successful  completion   TIFFOpen,   TIFFFdOpen,   and
     TIFFClientOpen  return  a  TIFF pointer.  Otherwise, NULL is
     returned.

DIAGNOSTICS
     All error messages are directed to  the  TIFFError(3T)  rou-
     tine.   Likewise,  warning  messages  are  directed  to  the
     TIFFWarning(3T) routine.

     "%s": Bad mode.  The specified mode parameter was not one of
     ``r'' (read), ``w'' (write), or ``a'' (append).

     %s: Cannot open.  TIFFOpen() was unable to open  the  speci-
     fied filename for read/writing.

     Cannot read TIFF header.  An error occurred while attempting
     to read the header information.

     Error writing TIFF header.  An error occurred while  writing
     the default header information for a new file.

     Not a TIFF file, bad magic  number  %d  (0x%x).   The  magic
     number in the header was not (hex) 0x4d4d or (hex) 0x4949.

     Not a TIFF file, bad version number %d (0x%x).  The  version
     field in the header was not 42 (decimal).

     Cannot append to file that has opposite  byte  ordering.   A
     file with a byte ordering opposite to the native byte order-
     ing of the current machine was opened for appending (``a'').
     This is a limitation of the library.

Sun Release 4.1  Last change: February 14, 1992                 2

TIFFOpen(3T)      MISC. REFERENCE MANUAL PAGES       TIFFOpen(3T)

SEE ALSO
     intro(3T), TIFFClose(3T)

Sun Release 4.1  Last change: February 14, 1992                 3