tiffcp Command in Linux



The tiffcp command in Linux copies and converts TIFF (Tagged Image File Format) files. It can merge multiple TIFF files into one, extract individual images, or change compression and other parameters.

Table of Contents

Here is a comprehensive guide to the options available with the tiffcp command in Linux −

Installation of tiffcp Command

The tiffcp command is part of the libtiff-tools package in Linux. Make sure the package is installed before using the command. To install it on Ubuntu, Kali Linux, Raspberry Pi OS, Debian, and other Debian-based distributions, use the following command −

sudo apt install libtiff-tools

To install it on Arch Linux, use the command below −

sudo pacman -S libtiff

To install libtiff-tools on Fedora, use the following command −

sudo dnf install libtiff-tools

To verify the installation of the tiffcp command, check its binary using the which command −

which tiffcp
tiffcp Command in Linux1

Syntax of tiffcp Command

The syntax of the tiffcp command in Linux is as follows −

tiffcp [options] input.tiff… output.tiff

In the above syntax, the [options] argument is used to specify options that modify how the command processes the input file. The input.tiff... is one or more source files, and the output.tiff is the destination file where the processed data will be saved.

Options of tiffcp Command

The options of the tiffcp command in Linux are as follows −

Options Description
-a Append to an existing output file.
-b image Subtract a monochrome image from all others to remove noise bias.
-B Force output with Big-Endian byte order.
-C Suppress strip chopping for a single strip/tile of uncompressed data.
-c Specify compression type (e.g., none, lzw, zip, jpeg, g3, g4, etc.).
-forder Set FillOrder (lsb2msb or msb2lsb).
-i Ignore non-fatal read errors.
-l length Specify tile length in pixels.
-L Force output with Little-Endian byte order.
-M Disable memory-mapped file reading.
-o offset Set initial directory offset.
-p config Set planar configuration (contig or separate).
-r rows Set the number of rows per strip.
-s Force data organization into strips.
-t Force data organization in tiles.
-w width Specify tile width in pixels.
-x Add sequential PageNumber tags to output pages.
-8 Write in BigTIFF format.
-,= char Substitute character for ',' in filenames.
-m size Set max memory allocation size in MiB (0 = no limit).

Using tiffcp Command in Linux

This section explores how to use the tiffcp command in Linux with examples −

Copying the Existing TIFF to a New TIFF

To copy the existing TIFF file to a new TIFF file, use the tiffcp command followed by the source file −

tiffcp sample.tiff output.tiff
tiffcp Command in Linux2

The above command copies sample.tiff to output.tiff without modifications.

Combining Multiple TIFF Files into One

To combine multiple TIFF files into one, use the tiffcp command in the following way −

tiffcp sample1.tiff sample2.tiff output.tiff
tiffcp Command in Linux3

The combined TIFF file is as follows −

tiffcp Command in Linux4

Another way to verify the number of TIFF files, use the following command −

tiffinfo output.tiff | grep directory
tiffcp Command in Linux5

The number of directories corresponds to the number of images (IFDs) within a single TIFF file. Each image in a TIFF file is stored in a separate structure called an Image File Directory (IFD).

Appending a TIFF File to an Existing Multipage TIFF

To append a TIFF file to an existing multi-page TIFF file, use the -a option −

tiffcp -a sample3.tiff output.tiff
tiffcp Command in Linux6

Changing the Compression Type

Copy the input TIFF to the output TIFF file using LZW compression, run the following command −

tiffcp -c lzw sample.tiff output.tiff

The -c option is used to specify the compression type. To combine multiple TIFF files with different compression types, use the tiffcp command in the following way −

tiffcp -c zip sample1.tiff -c lzw sample2.tiff output.tiff

Specifying the Number of Rows

To specify the number of rows, use the -r option. To set the strip size to 10 in the output file, use the following command −

tiffcp -r 10 sample1.tiff output.tiff

Organizing Data into Tiles

To force the data to be written into tiles rather than strips, use the -t option −

tiffcp -t -w 256 -l 256 sample.tiff output.tiff
tiffcp Command in Linux7

The -w and -l options are used to specify the width and length of the tile in pixels.

Forcing Output to Include Page Numbers

To force the output file to include the page number in sequence, use the -x option −

tiffcp -x sample1.tiff sample2.tiff output.tiff
tiffcp Command in Linux8

Ignoring Non-Fatal Errors

To ignore non-fatal read errors and continue processing the source file, use the -i option −

tiffcp -i sample.tiff output.tiff

Conclusion

The tiffcp command in Linux is used to copy and convert TIFF image files with various options to customize the output, such as compression type, data organization, byte order, and error handling. It supports combining multiple TIFF files, modifying strip or tile layout, and managing image attributes like page numbers.

Advertisements