| 1 |
tiffcp |
| 2 |
====== |
| 3 |
|
| 4 |
.. program:: tiffcp |
| 5 |
|
| 6 |
Synopsis |
| 7 |
-------- |
| 8 |
|
| 9 |
**tiffcp** [ *options* ] *src1.tif* … *srcN.tif* *dst.tif* |
| 10 |
|
| 11 |
Description |
| 12 |
----------- |
| 13 |
:program:`tiffcp` combines one or more files created according |
| 14 |
to the Tag Image File Format, Revision 6.0 into a single TIFF file. |
| 15 |
Because the output file may be compressed using a different |
| 16 |
algorithm than the input files, :program:`tiffcp` is most often |
| 17 |
used to convert between different compression schemes. |
| 18 |
|
| 19 |
By default, :program:`tiffcp` will copy all the understood tags in a |
| 20 |
TIFF directory of an input file to the associated directory in the output file. |
| 21 |
|
| 22 |
:program:`tiffcp` can be used to reorganize the storage characteristics of data |
| 23 |
in a file, but it is explicitly intended to not alter or convert |
| 24 |
the image data content in any way. |
| 25 |
|
| 26 |
Options |
| 27 |
------- |
| 28 |
|
| 29 |
.. option:: -a |
| 30 |
|
| 31 |
Append to an existing output file instead of overwriting it. |
| 32 |
|
| 33 |
.. option:: -b image |
| 34 |
|
| 35 |
subtract the following monochrome image from all others |
| 36 |
processed. This can be used to remove a noise bias |
| 37 |
from a set of images. This bias image is typically an |
| 38 |
image of noise the camera saw with its shutter closed. |
| 39 |
|
| 40 |
.. option:: -B |
| 41 |
|
| 42 |
Force output to be written with Big-Endian byte order. |
| 43 |
This option only has an effect when the output file is created or |
| 44 |
overwritten and not when it is appended to. |
| 45 |
|
| 46 |
.. option:: -C |
| 47 |
|
| 48 |
Suppress the use of "strip chopping" when reading images |
| 49 |
that have a single strip/tile of uncompressed data. |
| 50 |
|
| 51 |
.. option:: -c |
| 52 |
|
| 53 |
Specify the compression to use for data written to the output file: |
| 54 |
:command:`-c none` for no compression, |
| 55 |
:command:`-c packbits` for PackBits compression, |
| 56 |
:command:`-c lzw` for Lempel-Ziv & Welch compression, |
| 57 |
:command:`-c zip` for Deflate compression, |
| 58 |
:command:`-c lzma` for LZMA2 compression, |
| 59 |
:command:`-c jpeg` for baseline JPEG compression, |
| 60 |
:command:`-c g3` for CCITT Group 3 (T.4) compression, |
| 61 |
:command:`-c g4` for CCITT Group 4 (T.6) compression, or |
| 62 |
:command:`-c sgilog` for SGILOG compression. |
| 63 |
|
| 64 |
By default :program:`tiffcp` will compress data according to the |
| 65 |
value of the ``Compression`` tag found in the source file. |
| 66 |
|
| 67 |
The CCITT Group 3 and Group 4 compression algorithms can only |
| 68 |
be used with bilevel data. |
| 69 |
|
| 70 |
Group 3 compression can be specified together with several |
| 71 |
T.4-specific options: |
| 72 |
|
| 73 |
* ``1d`` for 1-dimensional encoding, |
| 74 |
* ``2d`` for 2-dimensional encoding, and |
| 75 |
* ``fill`` to force each encoded scanline to be zero-filled so that the |
| 76 |
terminating EOL code lies on a byte boundary. |
| 77 |
|
| 78 |
Group 3-specific options are specified by appending a ``:``-separated |
| 79 |
list to the ``g3`` option; e.g. :command:`-c g3:2d:fill` |
| 80 |
to get 2D-encoded data with byte-aligned EOL codes. |
| 81 |
|
| 82 |
LZW, Deflate and LZMA2 compression can be specified together with a |
| 83 |
``predictor`` value. A predictor value of 2 causes each scanline of the output image to |
| 84 |
undergo horizontal differencing before it is encoded; a value of 1 forces each |
| 85 |
scanline to be encoded without differencing. A value 3 is for floating point |
| 86 |
predictor which you can use if the encoded data are in floating point format. |
| 87 |
LZW-specific options are specified by appending a ``:``-separated list to the |
| 88 |
``lzw`` option; e.g. :command:`-c lzw:2` for LZW compression with horizontal differencing. |
| 89 |
|
| 90 |
Deflate and LZMA2 encoders support various compression levels (or encoder presets) set as |
| 91 |
character ``p`` and a preset number. ``p1`` is the fastest one with the worst |
| 92 |
compression ratio and ``p9`` is the slowest but with the best possible ratio; |
| 93 |
e.g. :command:`-c zip:3:p9` for |
| 94 |
Deflate encoding with maximum compression level and floating point predictor. |
| 95 |
|
| 96 |
For the Deflate codec, and in a libtiff build with libdeflate enabled, ``p12`` is |
| 97 |
actually the maximum level. |
| 98 |
|
| 99 |
For the Deflate codec, and in a libtiff build with libdeflate enabled, ``s0`` can be used to |
| 100 |
require zlib to be used, and ``s1`` for libdeflate (defaults to libdeflate when |
| 101 |
it is available). |
| 102 |
|
| 103 |
.. option:: -f fillorder |
| 104 |
|
| 105 |
Specify the bit fill order to use in writing output data. By default, :program:`tiffcp` |
| 106 |
will create a new file with the same fill order as the original. Specifying :command:`\-f lsb2msb` |
| 107 |
will force data to be written with the ``FillOrder`` tag set to ``LSB2MSB``, while |
| 108 |
:command:`\-f msb2lsb` will force data to be written with the ``FillOrder`` tag set to |
| 109 |
``MSB2LSB``. |
| 110 |
|
| 111 |
.. option:: -i |
| 112 |
|
| 113 |
Ignore non-fatal read errors and continue processing of the input file. |
| 114 |
|
| 115 |
.. option:: -l |
| 116 |
|
| 117 |
Specify the length of a tile (in pixels). |
| 118 |
|
| 119 |
:program:`tiffcp` attempts to set the tile dimensions so |
| 120 |
that no more than 8 kilobytes of data appear in a tile. |
| 121 |
|
| 122 |
.. option:: -L |
| 123 |
|
| 124 |
Force output to be written with Little-Endian byte order. |
| 125 |
This option only has an effect when the output file is created or |
| 126 |
overwritten and not when it is appended to. |
| 127 |
|
| 128 |
.. option:: -M |
| 129 |
|
| 130 |
Suppress the use of memory-mapped files when reading images. |
| 131 |
|
| 132 |
.. option:: -o offset |
| 133 |
|
| 134 |
Set initial directory offset. |
| 135 |
|
| 136 |
.. option:: -p |
| 137 |
|
| 138 |
Specify the planar configuration to use in writing image data |
| 139 |
that has one 8-bit sample per pixel. By default, :program:`tiffcp` |
| 140 |
will create a new file with the same planar configuration as |
| 141 |
the original. Specifying :command:`\-p contig` |
| 142 |
will force data to be written with multi-sample data packed |
| 143 |
together, while :command:`-p separate` |
| 144 |
will force samples to be written in separate planes. |
| 145 |
|
| 146 |
.. option:: -r |
| 147 |
|
| 148 |
Specify the number of rows (scanlines) in each strip of data |
| 149 |
written to the output file. By default (or when value **0** |
| 150 |
is specified), :program:`tiffcp` attempts to set the rows/strip |
| 151 |
that no more than 8 kilobytes of data appear in a strip. If you specify |
| 152 |
special value **-1** it will results in infinite number of the rows per |
| 153 |
strip. The entire image will be the one strip in that case. |
| 154 |
|
| 155 |
.. option:: -s |
| 156 |
|
| 157 |
Force the output file to be written with data organized in strips |
| 158 |
(rather than tiles). |
| 159 |
|
| 160 |
.. option:: -t |
| 161 |
|
| 162 |
Force the output file to be written with data organized in tiles (rather than |
| 163 |
strips). options can be used to force the resultant image to be written as |
| 164 |
strips or tiles of data, respectively. |
| 165 |
|
| 166 |
.. option:: -w |
| 167 |
|
| 168 |
Specify the width of a tile (in pixels). :program::`tiffcp` |
| 169 |
attempts to set the tile dimensions so that no more than 8 kilobytes of data |
| 170 |
appear in a tile. |
| 171 |
|
| 172 |
.. option:: -x |
| 173 |
|
| 174 |
Force the output file to be written with ``PAGENUMBER`` value in sequence. |
| 175 |
|
| 176 |
.. option:: -8 |
| 177 |
|
| 178 |
Write BigTIFF instead of classic TIFF format. |
| 179 |
|
| 180 |
.. option:: -,= character |
| 181 |
|
| 182 |
substitute *character* for ``,`` |
| 183 |
in parsing image directory indices |
| 184 |
in files. This is necessary if filenames contain commas. |
| 185 |
Note that ``-,=`` |
| 186 |
with whitespace immediately following will disable |
| 187 |
the special meaning of the ``,`` entirely. See examples. |
| 188 |
|
| 189 |
.. option:: -m size |
| 190 |
|
| 191 |
Set maximum memory allocation size (in MiB). The default is 256MiB. |
| 192 |
Set to 0 to disable the limit. |
| 193 |
|
| 194 |
Examples |
| 195 |
-------- |
| 196 |
|
| 197 |
The following concatenates two files and writes the result using LZW encoding: |
| 198 |
|
| 199 |
.. highlight:: shell |
| 200 |
|
| 201 |
:: |
| 202 |
|
| 203 |
tiffcp -c lzw a.tif b.tif result.tif |
| 204 |
|
| 205 |
To convert a G3 1d-encoded TIFF to a single strip of G4-encoded data the following might be used: |
| 206 |
|
| 207 |
:: |
| 208 |
|
| 209 |
tiffcp -c g4 -r 10000 g3.tif g4.tif |
| 210 |
|
| 211 |
(1000 is just a number that is larger than the number of rows in |
| 212 |
the source file.) |
| 213 |
|
| 214 |
To extract a selected set of images from a multi-image TIFF file, the file |
| 215 |
name may be immediately followed by a ``,`` separated list of image directory |
| 216 |
indices. The first image is always in directory 0. Thus, to copy the 1st and |
| 217 |
3rd images of image file :file:`album.tif` to :file:`result.tif`: |
| 218 |
|
| 219 |
:: |
| 220 |
|
| 221 |
tiffcp album.tif,0,2 result.tif |
| 222 |
|
| 223 |
A trailing comma denotes remaining images in sequence. The following command |
| 224 |
will copy all image with except the first one: |
| 225 |
|
| 226 |
:: |
| 227 |
|
| 228 |
tiffcp album.tif,1, result.tif |
| 229 |
|
| 230 |
Given file :file:`CCD.tif` whose first image is a noise bias |
| 231 |
followed by images which include that bias, |
| 232 |
subtract the noise from all those images following it |
| 233 |
(while decompressing) with the command: |
| 234 |
|
| 235 |
:: |
| 236 |
|
| 237 |
tiffcp -c none -b CCD.tif CCD.tif,1, result.tif |
| 238 |
|
| 239 |
If the file above were named :file:`CCD,X.tif`, the ``-,=`` |
| 240 |
option would be required to correctly parse this filename with image numbers, |
| 241 |
as follows: |
| 242 |
|
| 243 |
:: |
| 244 |
|
| 245 |
tiffcp -c none -,=% -b CCD,X.tif CCD,X%1%.tif result.tif |
| 246 |
|
| 247 |
See also |
| 248 |
-------- |
| 249 |
|
| 250 |
:doc:`pal2rgb` (1), |
| 251 |
:doc:`tiffinfo` (1), |
| 252 |
:doc:`tiffcmp` (1), |
| 253 |
:doc:`tiffmedian` (1), |
| 254 |
:doc:`tiffsplit` (1), |
| 255 |
:doc:`/functions/libtiff` (3tiff) |