summaryrefslogtreecommitdiff
path: root/doc/functions/TIFFDeferStrileArrayWriting.rst
blob: 60ee746927978fce38920f23f59b536eab01719f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
TIFFDeferStrileArrayWriting
===========================

Synopsis
--------

.. highlight:: c

::

    #include <tiffio.h>

.. c:function:: int TIFFDeferStrileArrayWriting(TIFF* tif)

.. c:function:: int TIFFForceStrileArrayWriting(TIFF* tif)

Description
-----------

:c:func:`TIFFDeferStrileArrayWriting` is an advanced writing function
that must be used in a particular sequence, and generally together
with  :c:func:`TIFFForceStrileArrayWriting`, to achieve its intended
effect. Their aim is to control when and where the
``StripOffsets`` / ``StripByteCounts`` or ``TileOffsets`` / ``TileByteCounts``
arrays are written into the file.

The purpose of this is to generate 'cloud-optimized geotiff' files where
the first KB of the file only contain the IFD entries without the potentially
large strile arrays. Those are written afterwards.

More precisely, when :c:func:`TIFFWriteCheck` is called, the tag entries for
those arrays will be written with type = count = offset = 0 as a temporary value.

Its effect is only valid for the current directory, and before
:c:func:`TIFFWriteDirectory` is first called, and  will be reset
when changing directory.

The typical sequence of calls is:

.. highlight:: c

::

 TIFFOpen()
 /* or TIFFCreateDirectory(tif) */
 /* Set fields with calls to TIFFSetField(tif, ...) */
 TIFFDeferStrileArrayWriting(tif)
 TIFFWriteCheck(tif, ...)
 TIFFWriteDirectory(tif)
 /* ... potentially create other directories and come back to the above directory */
 TIFFForceStrileArrayWriting(tif) /* emit the arrays at the end of file */

Returns
-------

1 in case of success, 0 otherwise.

Diagnostics
-----------

All error messages are directed to the :c:func:`TIFFErrorExtR` routine.
Likewise, warning messages are directed to the :c:func:`TIFFWarningExtR` routine.

See also
--------

:doc:`libtiff` (3tiff)