roentgen b75cab
.\" $Id: tiffcp.1,v 1.12 2010-12-23 13:38:47 dron Exp $
roentgen b75cab
.\"
roentgen b75cab
.\" Copyright (c) 1988-1997 Sam Leffler
roentgen b75cab
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
roentgen b75cab
.\"
roentgen b75cab
.\" Permission to use, copy, modify, distribute, and sell this software and 
roentgen b75cab
.\" its documentation for any purpose is hereby granted without fee, provided
roentgen b75cab
.\" that (i) the above copyright notices and this permission notice appear in
roentgen b75cab
.\" all copies of the software and related documentation, and (ii) the names of
roentgen b75cab
.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
roentgen b75cab
.\" publicity relating to the software without the specific, prior written
roentgen b75cab
.\" permission of Sam Leffler and Silicon Graphics.
roentgen b75cab
.\" 
roentgen b75cab
.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
roentgen b75cab
.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
roentgen b75cab
.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
roentgen b75cab
.\" 
roentgen b75cab
.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
roentgen b75cab
.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
roentgen b75cab
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
roentgen b75cab
.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
roentgen b75cab
.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
roentgen b75cab
.\" OF THIS SOFTWARE.
roentgen b75cab
.\"
roentgen b75cab
.if n .po 0
roentgen b75cab
.TH TIFFCP 1 "February 24, 2007" "libtiff"
roentgen b75cab
.SH NAME
roentgen b75cab
tiffcp \- copy (and possibly convert) a
roentgen b75cab
.SM TIFF
roentgen b75cab
file
roentgen b75cab
.SH SYNOPSIS
roentgen b75cab
.B tiffcp
roentgen b75cab
[
roentgen b75cab
.I options
roentgen b75cab
]
roentgen b75cab
.I "src1.tif ... srcN.tif dst.tif"
roentgen b75cab
.SH DESCRIPTION
roentgen b75cab
.I tiffcp
roentgen b75cab
combines one or more files created according
roentgen b75cab
to the Tag Image File Format, Revision 6.0
roentgen b75cab
into a single
roentgen b75cab
.SM TIFF
roentgen b75cab
file.
roentgen b75cab
Because the output file may be compressed using a different
roentgen b75cab
algorithm than the input files,
roentgen b75cab
.I tiffcp
roentgen b75cab
is most often used to convert between different compression
roentgen b75cab
schemes.
roentgen b75cab
.PP
roentgen b75cab
By default, 
roentgen b75cab
.I tiffcp
roentgen b75cab
will copy all the understood tags in a
roentgen b75cab
.SM TIFF
roentgen b75cab
directory of an input
roentgen b75cab
file to the associated directory in the output file.
roentgen b75cab
.PP
roentgen b75cab
.I tiffcp
roentgen b75cab
can be used to reorganize the storage characteristics of data
roentgen b75cab
in a file, but it is explicitly intended to not alter or convert
roentgen b75cab
the image data content in any way.
roentgen b75cab
.SH OPTIONS
roentgen b75cab
.TP
roentgen b75cab
.BI \-b " image"
roentgen b75cab
subtract the following monochrome image from all others
roentgen b75cab
processed.  This can be used to remove a noise bias
roentgen b75cab
from a set of images.  This bias image is typically an
roentgen b75cab
image of noise the camera saw with its shutter closed.
roentgen b75cab
.TP
roentgen b75cab
.B \-B
roentgen b75cab
Force output to be written with Big-Endian byte order.
roentgen b75cab
This option only has an effect when the output file is created or
roentgen b75cab
overwritten and not when it is appended to.
roentgen b75cab
.TP
roentgen b75cab
.B \-C
roentgen b75cab
Suppress the use of ``strip chopping'' when reading images
roentgen b75cab
that have a single strip/tile of uncompressed data.
roentgen b75cab
.TP
roentgen b75cab
.B \-c
roentgen b75cab
Specify the compression to use for data written to the output file:
roentgen b75cab
.B none 
roentgen b75cab
for no compression,
roentgen b75cab
.B packbits
roentgen b75cab
for PackBits compression,
roentgen b75cab
.B lzw
roentgen b75cab
for Lempel-Ziv & Welch compression,
roentgen b75cab
.B zip
roentgen b75cab
for Deflate compression,
roentgen b75cab
.B lzma
roentgen b75cab
for LZMA2 compression,
roentgen b75cab
.B jpeg
roentgen b75cab
for baseline JPEG compression,
roentgen b75cab
.B g3
roentgen b75cab
for CCITT Group 3 (T.4) compression,
roentgen b75cab
and
roentgen b75cab
.B g4
roentgen b75cab
for CCITT Group 4 (T.6) compression.
roentgen b75cab
By default
roentgen b75cab
.I tiffcp
roentgen b75cab
will compress data according to the value of the
roentgen b75cab
.I Compression
roentgen b75cab
tag found in the source file.
roentgen b75cab
.IP
roentgen b75cab
The
roentgen b75cab
.SM CCITT
roentgen b75cab
Group 3 and Group 4 compression algorithms can only
roentgen b75cab
be used with bilevel data.
roentgen b75cab
.IP
roentgen b75cab
Group 3 compression can be specified together with several
roentgen b75cab
T.4-specific options:
roentgen b75cab
.B 1d
roentgen b75cab
for 1-dimensional encoding,
roentgen b75cab
.B 2d
roentgen b75cab
for 2-dimensional encoding,
roentgen b75cab
and
roentgen b75cab
.B fill
roentgen b75cab
to force each encoded scanline to be zero-filled so that the
roentgen b75cab
terminating EOL code lies on a byte boundary.
roentgen b75cab
Group 3-specific options are specified by appending a ``:''-separated
roentgen b75cab
list to the ``g3'' option; e.g.
roentgen b75cab
.B "\-c g3:2d:fill"
roentgen b75cab
to get 2D-encoded data with byte-aligned EOL codes.
roentgen b75cab
.IP
roentgen b75cab
.SM LZW, Deflate
roentgen b75cab
and
roentgen b75cab
.SM LZMA2
roentgen b75cab
compression can be specified together with a 
roentgen b75cab
.I predictor
roentgen b75cab
value. A predictor value of 2 causes each scanline of the output image to
roentgen b75cab
undergo horizontal differencing before it is encoded; a value of 1 forces each
roentgen b75cab
scanline to be encoded without differencing. A value 3 is for floating point
roentgen b75cab
predictor which you can use if the encoded data are in floating point format.
roentgen b75cab
LZW-specific options are specified by appending a ``:''-separated list to the
roentgen b75cab
``lzw'' option; e.g.
roentgen b75cab
.B "\-c lzw:2"
roentgen b75cab
for
roentgen b75cab
.SM LZW
roentgen b75cab
compression with horizontal differencing.
roentgen b75cab
.IP
roentgen b75cab
.SM Deflate
roentgen b75cab
and
roentgen b75cab
.SM LZMA2
roentgen b75cab
encoders support various compression levels (or encoder presets) set as
roentgen b75cab
character ``p'' and a preset number. ``p1'' is the fastest one with the worst
roentgen b75cab
compression ratio and ``p9'' is the slowest but with the best possible ratio;
roentgen b75cab
e.g.
roentgen b75cab
.B "\-c zip:3:p9"
roentgen b75cab
for
roentgen b75cab
.SM Deflate
roentgen b75cab
encoding with maximum compression level and floating point predictor.
roentgen b75cab
.TP
roentgen b75cab
.B \-f
roentgen b75cab
Specify the bit fill order to use in writing output data.
roentgen b75cab
By default,
roentgen b75cab
.I tiffcp
roentgen b75cab
will create a new file with the same fill order as the original.
roentgen b75cab
Specifying
roentgen b75cab
.B "\-f lsb2msb"
roentgen b75cab
will force data to be written with the FillOrder tag set to
roentgen b75cab
.SM LSB2MSB,
roentgen b75cab
while
roentgen b75cab
.B "\-f msb2lsb"
roentgen b75cab
will force data to be written with the FillOrder tag set to
roentgen b75cab
.SM MSB2LSB.
roentgen b75cab
.TP
roentgen b75cab
.B \-i
roentgen b75cab
Ignore non-fatal read errors and continue processing of the input file.
roentgen b75cab
.TP
roentgen b75cab
.B \-l
roentgen b75cab
Specify the length of a tile (in pixels).
roentgen b75cab
.I tiffcp
roentgen b75cab
attempts to set the tile dimensions so
roentgen b75cab
that no more than 8 kilobytes of data appear in a tile.
roentgen b75cab
.TP
roentgen b75cab
.B \-L
roentgen b75cab
Force output to be written with Little-Endian byte order.
roentgen b75cab
This option only has an effect when the output file is created or
roentgen b75cab
overwritten and not when it is appended to.
roentgen b75cab
.TP
roentgen b75cab
.B \-M
roentgen b75cab
Suppress the use of memory-mapped files when reading images.
roentgen b75cab
.TP
roentgen b75cab
.B \-p
roentgen b75cab
Specify the planar configuration to use in writing image data
roentgen b75cab
that has one 8-bit sample per pixel.
roentgen b75cab
By default,
roentgen b75cab
.I tiffcp
roentgen b75cab
will create a new file with the same planar configuration as
roentgen b75cab
the original.
roentgen b75cab
Specifying
roentgen b75cab
.B "\-p contig"
roentgen b75cab
will force data to be written with multi-sample data packed
roentgen b75cab
together, while
roentgen b75cab
.B "\-p separate"
roentgen b75cab
will force samples to be written in separate planes.
roentgen b75cab
.TP
roentgen b75cab
.B \-r
roentgen b75cab
Specify the number of rows (scanlines) in each strip of data
roentgen b75cab
written to the output file.
roentgen b75cab
By default (or when value
roentgen b75cab
.B 0
roentgen b75cab
is specified),
roentgen b75cab
.I tiffcp
roentgen b75cab
attempts to set the rows/strip
roentgen b75cab
that no more than 8 kilobytes of data appear in a strip. If you specify
roentgen b75cab
special value
roentgen b75cab
.B \-1
roentgen b75cab
it will results in infinite number of the rows per strip. The entire image
roentgen b75cab
will be the one strip in that case.
roentgen b75cab
.TP
roentgen b75cab
.B \-s
roentgen b75cab
Force the output file to be written with data organized in strips
roentgen b75cab
(rather than tiles).
roentgen b75cab
.TP
roentgen b75cab
.B \-t
roentgen b75cab
Force the output file to be written with data organized in tiles (rather than
roentgen b75cab
strips). options can be used to force the resultant image to be written as
roentgen b75cab
strips or tiles of data, respectively.
roentgen b75cab
.TP
roentgen b75cab
.B \-w
roentgen b75cab
Specify the width of a tile (in pixels).
roentgen b75cab
.I tiffcp
roentgen b75cab
attempts to set the tile dimensions so that no more than 8 kilobytes of data
roentgen b75cab
appear in a tile.
roentgen b75cab
.I tiffcp
roentgen b75cab
attempts to set the tile dimensions so that no more than 8 kilobytes of data
roentgen b75cab
appear in a tile.
roentgen b75cab
.TP
roentgen b75cab
.B \-x
roentgen b75cab
Force the output file to be written with PAGENUMBER value in sequence.
roentgen b75cab
.TP
roentgen b75cab
.BI \-,= character
roentgen b75cab
substitute
roentgen b75cab
.I character
roentgen b75cab
for `,' in parsing image directory indices
roentgen b75cab
in files.  This is necessary if filenames contain commas.
roentgen b75cab
Note that
roentgen b75cab
.B \-,=
roentgen b75cab
with whitespace immediately following will disable
roentgen b75cab
the special meaning of the `,' entirely.  See examples.
roentgen b75cab
.SH EXAMPLES
roentgen b75cab
The following concatenates two files and writes the result using 
roentgen b75cab
.SM LZW
roentgen b75cab
encoding:
roentgen b75cab
.RS
roentgen b75cab
.nf
roentgen b75cab
tiffcp \-c lzw a.tif b.tif result.tif
roentgen b75cab
.fi
roentgen b75cab
.RE
roentgen b75cab
.PP
roentgen b75cab
To convert a G3 1d-encoded 
roentgen b75cab
.SM TIFF
roentgen b75cab
to a single strip of G4-encoded data the following might be used:
roentgen b75cab
.RS
roentgen b75cab
.nf
roentgen b75cab
tiffcp \-c g4 \-r 10000 g3.tif g4.tif
roentgen b75cab
.fi
roentgen b75cab
.RE
roentgen b75cab
(1000 is just a number that is larger than the number of rows in
roentgen b75cab
the source file.)
roentgen b75cab
roentgen b75cab
To extract a selected set of images from a multi-image TIFF file, the file
roentgen b75cab
name may be immediately followed by a `,' separated list of image directory
roentgen b75cab
indices.  The first image is always in directory 0.  Thus, to copy the 1st and
roentgen b75cab
3rd images of image file ``album.tif'' to ``result.tif'':
roentgen b75cab
.RS
roentgen b75cab
.nf
roentgen b75cab
tiffcp album.tif,0,2 result.tif
roentgen b75cab
.fi
roentgen b75cab
.RE
roentgen b75cab
roentgen b75cab
A trailing comma denotes remaining images in sequence.  The following command
roentgen b75cab
will copy all image with except the first one:
roentgen b75cab
.RS
roentgen b75cab
.nf
roentgen b75cab
tiffcp album.tif,1, result.tif
roentgen b75cab
.fi
roentgen b75cab
.RE
roentgen b75cab
roentgen b75cab
Given file ``CCD.tif'' whose first image is a noise bias
roentgen b75cab
followed by images which include that bias,
roentgen b75cab
subtract the noise from all those images following it
roentgen b75cab
(while decompressing) with the command:
roentgen b75cab
.RS
roentgen b75cab
.nf
roentgen b75cab
tiffcp \-c none \-b CCD.tif CCD.tif,1, result.tif
roentgen b75cab
.fi
roentgen b75cab
.RE
roentgen b75cab
roentgen b75cab
If the file above were named ``CCD,X.tif'', the
roentgen b75cab
.B \-,=
roentgen b75cab
option would
roentgen b75cab
be required to correctly parse this filename with image numbers,
roentgen b75cab
as follows:
roentgen b75cab
.RS
roentgen b75cab
.nf
roentgen b75cab
tiffcp \-c none \-,=% \-b CCD,X.tif CCD,X%1%.tif result.tif
roentgen b75cab
.SH "SEE ALSO"
roentgen b75cab
.BR pal2rgb (1),
roentgen b75cab
.BR tiffinfo (1),
roentgen b75cab
.BR tiffcmp (1),
roentgen b75cab
.BR tiffmedian (1),
roentgen b75cab
.BR tiffsplit (1),
roentgen b75cab
.BR libtiff (3TIFF)
roentgen b75cab
.PP
roentgen b75cab
Libtiff library home page:
roentgen b75cab
.BR http://www.remotesensing.org/libtiff/