2009.01.06 19:13 "[Tiff] Removing an image from a multipage tiff file", by Richard Nolde

Mark,

Tiffcrop has the ability to perform the functions of tiffsplit and tiffcp in one pass. It also has a very flexible syntax for specifying the images that you want to extract and how they will be combined/separated in the destination file(s). If you want to test my latest code before it get released with the next distribution, please let me know. Many of the options are only available in the latest release including the export options and the ability to handle images with bits per sample from 1 - 32 inclusive.

I believe that there have been some posts regarding the inefficiency of the the directory scanning code which is designed to prevent infinite loops when reading files from bogus tiff writing utilities. I don't know if this has been addressed in recent builds.

Richard Nolde

Tiffcrop author

TIFFCROP(1) TIFFCROP(1)

NAME

tiffcrop - select, copy, crop, convert, extract, and/or process one or more TIFF files.

SYNOPSIS
tiffcrop [ options ] src1.tif... srcN.tif dst.tif

DESCRIPTION

tiffcrop processes one or more files created according to the Tag Image File Format, Revision 6.0, specification into one or more TIFF file(s). Tiffcrop is most often used to extract portions of an image for processing with bar code recog- nizer or OCR software when that software cannot restrict the region of interest to a specific portion of the image or to improve efficiency when the regions of interest must be rotated. It can also be used to subdivide all or part of a pro- cessed image into smaller sections and export individual images or sections of images as separate files or separate images within one or more files derived from the original input image or images.

The available functions can be grouped broadly into three classes:

Those that select individual images or sections of images from the input files. The options -N for sequences or lists of individual images in the input files, -Z for zones, -z for regions, -X and -Y for fixed sized selections, -m for margins, -U for units, and -E for edge reference provide a variety of ways to specify portions of the input image.

Those that allow the individual images or selections to be exported to one or more output files in different groupings and control the organization of the data in the output images. The options -P for page size grouping, -S for subdivision into columns and rows and -e for export mode options that produce one or more files from each input image. The options -r, -s, -t, -w control strip and tile format and sizes while -B -L -c -f modify the endian addressing scheme, the compression options, and the bit fill sequence of images as they are written.

Those that perform some action on each image that is selected from the input file. The options include -R for rotate, -I for inversion of the photometric interpretation and/or data values, and -F to flip (mirror) the image horizontally or vertically.

Functions are applied to the input image(s) in the following order: cropping, fixed area extraction, zone and region extraction, inversion, mirroring, rotation.

Functions are applied to the output image(s) in the following order: export mode options for grouping zones, regions, or images into one or more files, or row and column divisions with output margins, or page size divisions with page orienta- tion options.

Finally, strip, tile, byte order, output resolution, and compression options are applied to all output images.

The output file(s) may be organized and compressed using a different algorithm from the input files. By default, tiffcrop will copy all the understood tags in a TIFF directory of an input file to the associated directory in the output file. Options can be used to force the resultant image to be written as strips or tiles of data, respectively.

Tiffcrop can be used to reorganize the storage characteristics of data in a file,

hp