tiffinfo Command in Linux



The tiffinfo command in Linux prints information about TIFF files. It displays metadata from TIFF files, showing the contents of each directory with tag values presented symbolically when appropriate.

Table of Contents

Here is a comprehensive guide to the options available with the tiffinfo command −

Installation of tiffinfo Command

The tiffinfo 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 tiffinfo command, check its binary using the which command −

which tiffinfo
tiffinfo Command in Linux1

Syntax of tiffinfo Command

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

tiffinfo [options] [filename]

In the above syntax, the [options] field is used to specify various options to change the output. The [filename] field is used to specify the input TIFF image file.

tiffinfo Command Options

The options of the tiffinfo command are listed below −

Option Description
-c Display the colormap and color/gray response curves, if available.
-D Read and decompress all image data without displaying it.
-d Print each byte of decompressed data in hexadecimal.
-f lsb2msb Force lsb-to-msb FillOrder for input.
-f msb2lsb Force msb-to-lsb FillOrder for input.
-j Show JPEG-related tags.
-o Start at a specific TIFF directory offset (supports 0x for hex, 0 for octal).
-r Read/display raw image data instead of decoded data.
-s Show offsets and byte counts for each data strip.
-w Display raw data in words.
-z Enable strip chopping when reading image data.
-# Start at the specified directory number.

Examples of tiffinfo Command in Linux

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

  • Displaying All Directory Tags of a TIFF File
  • Viewing Color Maps and Curves
  • Displaying JPEG Tags
  • Showing Strip Offsets and Byte Counts
  • Decompressing Data (No Output)
  • Printing Each Byte of Decompressed Data in Hexadecimal
  • Opening a Specific Directory Offset
  • Opening a Specific Directory by a Number
  • Enabling Strip Chopping

Displaying All Directory Tags of a TIFF File

To display all the directory tags of a TIFF file, use the tiffinfo command followed by the filename −

tiffinfo sample.tiff
tiffinfo Command in Linux2

Viewing Color Maps and Curves

If the colormap and color/gray response curves are available, use the -c option to display them −

tiffinfo -c sample.tiff

Displaying JPEG Tags

To display the JPEG-related tags in a TIFF file, use the -j option with the tiffinfo command −

tiffinfo -j sample.tiff

Showing Strip Offsets and Byte Counts

To print the offsets and byte sizes for each data strip, use the -s option −

tiffinfo -s sample.tiff
tiffinfo Command in Linux3

Decompressing Data (No Output)

To decompress image data without displaying it, use the -D option −

tiffinfo -D sample.tiff

Printing Each Byte of Decompressed Data in Hexadecimal

To print each byte of decompressed image data in hexadecimal, use the -d option −

tiffinfo -d sample.tiff
tiffinfo Command in Linux4

Opening a Specific Directory Offset

To start processing at the directory located at the hexadecimal offset 0x8, use the -o option −

tiffinfo -o 0x8 sample.tiff
tiffinfo Command in Linux5

Opening a Specific Directory by a Number

To open a specific directory by a number, use the -# option, replacing # with a number −

tiffinfo -0 sample.tiff
tiffinfo Command in Linux6

The tiffinfo -1 sample.tiff command shows no output. This suggests that the TIFF file either only has one directory (so directory 1 does not exist) or tiffinfo attempted to find directory 1, found nothing, but still exited without error.

Enabling Strip Chopping

Strip chopping is a process used in the TIFF image format to break large strips of image data into smaller, more manageable pieces during reading. To enable strip chopping when reading the TIFF image data, use the -z option −

tiffinfo -z sample.tiff

Conclusion

The tiffinfo command in Linux is a useful tool for examining the metadata of TIFF image files. It provides detailed information about image directories, tags, and compression data, with options to display color maps, JPEG tags, strip offsets, and more.

Advertisements