kusano 7d535a
.\" $Id: tiffcrop.1,v 1.7 2010-12-12 01:45:35 faxguy Exp $
kusano 7d535a
.\" tiffcrop -- a port of tiffcp.c extended to include extended processing of images
kusano 7d535a
.\" 
kusano 7d535a
.\" Original code:
kusano 7d535a
.\" 
kusano 7d535a
.\" Copyright (c) 1988-1997 Sam Leffler
kusano 7d535a
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
kusano 7d535a
.\" 
kusano 7d535a
.\" Permission to use, copy, modify, distribute, and sell this software and 
kusano 7d535a
.\" its documentation for any purpose is hereby granted without fee, provided
kusano 7d535a
.\" that (i) the above copyright notices and this permission notice appear in
kusano 7d535a
.\" all copies of the software and related documentation, and (ii) the names of
kusano 7d535a
.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
kusano 7d535a
.\" publicity relating to the software without the specific, prior written
kusano 7d535a
.\" permission of Sam Leffler and Silicon Graphics.
kusano 7d535a
.\" 
kusano 7d535a
.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
kusano 7d535a
.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
kusano 7d535a
.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
kusano 7d535a
.\" 
kusano 7d535a
.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
kusano 7d535a
.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
kusano 7d535a
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
kusano 7d535a
.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
kusano 7d535a
.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
kusano 7d535a
.\" OF THIS SOFTWARE.
kusano 7d535a
.\" 
kusano 7d535a
.\" Additional code Copyright (c) 2006-2009 Richard Nolde 
kusano 7d535a
.\" Lasted Updated 9/2009
kusano 7d535a
.\" .if n .po 0
kusano 7d535a
.TH "TIFFCROP" "1" "December, 2008" "libtiff" ""
kusano 7d535a
.SH "NAME"
kusano 7d535a
tiffcrop \- select, copy, crop, convert, extract, and/or process one or more
kusano 7d535a
.SM TIFF
kusano 7d535a
files.
kusano 7d535a
.SH "SYNOPSIS"
kusano 7d535a
.B tiffcrop
kusano 7d535a
[
kusano 7d535a
.I options
kusano 7d535a
]
kusano 7d535a
.I "src1.tif ... srcN.tif dst.tif"
kusano 7d535a
.SH "DESCRIPTION"
kusano 7d535a
.I Tiffcrop
kusano 7d535a
processes one or more files created according
kusano 7d535a
to the Tag Image File Format, Revision 6.0, specification
kusano 7d535a
into one or more
kusano 7d535a
.SM TIFF
kusano 7d535a
file(s).
kusano 7d535a
.I Tiffcrop
kusano 7d535a
is most often used to extract portions of an image for processing 
kusano 7d535a
with bar code recognizer or OCR software when that software cannot 
kusano 7d535a
restrict the region of interest to a specific portion of the image 
kusano 7d535a
or to improve efficiency when the regions of interest must be rotated.
kusano 7d535a
It can also be used to subdivide all or part of a processed image into 
kusano 7d535a
smaller sections and export individual images or sections of images
kusano 7d535a
as separate files or separate images within one or more files derived
kusano 7d535a
from the original input image or images.
kusano 7d535a
.PP 
kusano 7d535a
The available functions can be grouped broadly into three classes:
kusano 7d535a
.IP 
kusano 7d535a
Those that select individual images or sections of images from the input files.
kusano 7d535a
The options \-N for sequences or lists of individual images in the input files,
kusano 7d535a
\-Z for zones, \-z for regions, \-X and \-Y for fixed sized selections,
kusano 7d535a
\-m for margins, \-U for units, and \-E for edge reference provide a variety of 
kusano 7d535a
ways to specify portions of the input image.
kusano 7d535a
.IP 
kusano 7d535a
Those that allow the individual images or selections to be exported to one or
kusano 7d535a
more output files in different groupings and control the organization of the 
kusano 7d535a
data in the output images. The options \-P for page size grouping, \-S for 
kusano 7d535a
subdivision into columns and rows and \-e for export mode options that produce
kusano 7d535a
one or more files from each input image. The options \-r, \-s, \-t, \-w  control 
kusano 7d535a
strip and tile format and sizes while \-B \-L \-c \-f modify the endian addressing
kusano 7d535a
scheme, the compression options, and the bit fill sequence of images as they
kusano 7d535a
are written.
kusano 7d535a
.IP 
kusano 7d535a
Those that perform some action on each image that is selected from the input file.
kusano 7d535a
The options include \-R for rotate, \-I for inversion of the photometric 
kusano 7d535a
interpretation and/or data values, and \-F to flip (mirror) the image horizontally
kusano 7d535a
or vertically.
kusano 7d535a
.PP 
kusano 7d535a
kusano 7d535a
Functions are applied to the input image(s) in the following order:
kusano 7d535a
cropping, fixed area extraction, zone and region extraction, 
kusano 7d535a
inversion, mirroring, rotation.
kusano 7d535a
.PP 
kusano 7d535a
Functions are applied to the output image(s) in the following order:
kusano 7d535a
export mode options for grouping zones, regions, or images into
kusano 7d535a
one or more files,
kusano 7d535a
.I or
kusano 7d535a
row and column divisions with output margins,
kusano 7d535a
.I or
kusano 7d535a
page size divisions with page orientation options.
kusano 7d535a
.PP 
kusano 7d535a
Finally, strip, tile, byte order, output resolution, and compression options are 
kusano 7d535a
applied to all output images.
kusano 7d535a
.PP 
kusano 7d535a
The output file(s) may be organized and compressed using a different
kusano 7d535a
algorithm from the input files.
kusano 7d535a
By default, 
kusano 7d535a
.I tiffcrop
kusano 7d535a
will copy all the understood tags in a
kusano 7d535a
.SM TIFF
kusano 7d535a
directory of an input file to the associated directory in the output file.
kusano 7d535a
Options can be used to force the resultant image to be written as strips 
kusano 7d535a
or tiles of data, respectively.
kusano 7d535a
.PP 
kusano 7d535a
.I Tiffcrop
kusano 7d535a
can be used to reorganize the storage characteristics of data
kusano 7d535a
in a file, and to reorganize, extract, rotate, and otherwise
kusano 7d535a
process the image data as specified at the same time whereas 
kusano 7d535a
tiffcp does not alter the image data within the file. 
kusano 7d535a
.PP 
kusano 7d535a
Using the options for selecting individual input images and the 
kusano 7d535a
options for exporting images and/or segments defined as zones or
kusano 7d535a
regions of each input image,
kusano 7d535a
.I tiffcrop
kusano 7d535a
can perform the functions of tiffcp and tiffsplit in a single pass
kusano 7d535a
while applying multiple operations to individual selections or images.
kusano 7d535a
.PP 
kusano 7d535a
.SH "OPTIONS"
kusano 7d535a
.TP 
kusano 7d535a
.B \-h
kusano 7d535a
Display the syntax summary for tiffcrop.
kusano 7d535a
.TP 
kusano 7d535a
.B \-v
kusano 7d535a
Report the current version and last modification date for tiffcrop.
kusano 7d535a
.TP 
kusano 7d535a
.B \-N odd|even|#,#\-#,#|last
kusano 7d535a
Specify one or more series or range(s) of images within each file to process.
kusano 7d535a
The words
kusano 7d535a
.B odd
kusano 7d535a
or
kusano 7d535a
.B even
kusano 7d535a
may be used to specify all odd or even numbered images counting from one.
kusano 7d535a
Note that internally, TIFF images are numbered from zero rather than one
kusano 7d535a
but since this convention is not obvious to most users, tiffcrop used 1
kusano 7d535a
to specifiy the first image in a multipage file.  The word
kusano 7d535a
.B last 
kusano 7d535a
may be used in place of a number in the sequence to indicate the 
kusano 7d535a
final image in the file without knowing how many images there are.
kusano 7d535a
Ranges of images may be specified with a dash and multiple sets
kusano 7d535a
can be indicated by joining them in a comma\-separated list. eg. use
kusano 7d535a
.B \-N 1,5\-7,last 
kusano 7d535a
to process the 1st, 5th through 7th, and final image in the file.
kusano 7d535a
.TP 
kusano 7d535a
.B \-E top|bottom|left|right
kusano 7d535a
Specify the top, bottom, left, or right edge as the reference from
kusano 7d535a
which to calcuate the width and length of crop regions or sequence
kusano 7d535a
of postions for zones. When used with the \-e option for exporting
kusano 7d535a
zones or regions, the reference edge determines how composite images
kusano 7d535a
are arranged. Using \-E left or right causes successive zones or 
kusano 7d535a
regions to be merged horizontally whereas using \-E top or bottom
kusano 7d535a
causes successive zones or regions to be arranged vertically. This 
kusano 7d535a
option has no effect on export layout when multiple zones or regions
kusano 7d535a
are not being exported to composite images. Edges may be abbreviated
kusano 7d535a
to the first letter.
kusano 7d535a
.TP 
kusano 7d535a
.B \-e combined|divided|image|multiple|separate
kusano 7d535a
Specify the export mode for images and selections from input images.
kusano 7d535a
The final filename on the command line is considered to be the 
kusano 7d535a
destination file or filename stem for automatically generated 
kusano 7d535a
sequences of files. Modes may be abbreviated to the first letter.
kusano 7d535a
.IP 
kusano 7d535a
combined   All images and selections are written to a single file with
kusano 7d535a
multiple selections from one image combined into a single image (default)
kusano 7d535a
.IP 
kusano 7d535a
divided    All images and selections are written to a single file
kusano 7d535a
with each selection from one image written to a new image
kusano 7d535a
.IP 
kusano 7d535a
image      Each input image is written to a new file (numeric filename sequence)
kusano 7d535a
with multiple selections from the image combined into one image
kusano 7d535a
.IP 
kusano 7d535a
multiple   Each input image is written to a new file (numeric filename sequence)
kusano 7d535a
with each selection from the image written to a new image
kusano 7d535a
.IP 
kusano 7d535a
separate   Individual selections from each image are written to separate files
kusano 7d535a
.TP 
kusano 7d535a
.B \-U in|cm|px
kusano 7d535a
Specify the type of units to apply to dimensions for margins and 
kusano 7d535a
crop regions for input and output images. Inches or centimeters 
kusano 7d535a
are converted to pixels using the resolution unit specified in the 
kusano 7d535a
TIFF file (which defaults to inches if not specified in the IFD).
kusano 7d535a
.TP 
kusano 7d535a
.B \-m #,#,#,#
kusano 7d535a
Specify margins to be removed from the input image. The order must 
kusano 7d535a
be top, left, bottom, right with only commas separating the elements 
kusano 7d535a
of the list. Margins are scaled according to the current units and 
kusano 7d535a
removed before any other extractions are computed..
kusano 7d535a
.TP 
kusano 7d535a
.B \-X #
kusano 7d535a
Set the horizontal (X\-axis) dimension of a region to extract relative to 
kusano 7d535a
the specified origin reference. If the origin is the top or bottom
kusano 7d535a
edge, the X axis value will be assumed to start at the left edge.
kusano 7d535a
.TP 
kusano 7d535a
.B \-Y #
kusano 7d535a
Set the vertical (Y\-axis) dimension of a region to extract relative to
kusano 7d535a
the specified origin reference. If the origin is the left or right
kusano 7d535a
edge, the Y axis value will be assumed to start at the top.
kusano 7d535a
.TP 
kusano 7d535a
.B \-Z  #:#,#:#  
kusano 7d535a
Specify zones of the image designated as position X of Y equal sized portions
kusano 7d535a
measured from the reference edge,  eg 1:3 would be first third of the
kusano 7d535a
image starting from the reference edge minus any margins specified
kusano 7d535a
for the confining edges. Multiple zones can be specified as a comma
kusano 7d535a
separated list but they must reference the same edge. To extract the
kusano 7d535a
top quarter and the bottom third of an image you would use 
kusano 7d535a
.B \-Z 1:4,3:3.
kusano 7d535a
.TP 
kusano 7d535a
.B \-z x1,y1,x2,y2: ... :xN,yN,xN+1,yN+1 
kusano 7d535a
Specify a series of coordinates to define regions for processing and exporting.
kusano 7d535a
The coordinates represent the top left and lower right corners of each region 
kusano 7d535a
in the current units, eg inch, cm, or pixels. Pixels are counted from one to 
kusano 7d535a
width or height and inches or cm are calculated from image resolution data.
kusano 7d535a
kusano 7d535a
Each colon delimited series of four values represents the horizontal and vertical 
kusano 7d535a
offsets from the top and left edges of the image, regardless of the edge specified
kusano 7d535a
with the \-E option. The first and third values represent the horizontal offsets of 
kusano 7d535a
the corner points from the left edge while the second and fourth values represent 
kusano 7d535a
the vertical offsets from the top edge.
kusano 7d535a
.TP 
kusano 7d535a
.B \-F horiz|vert
kusano 7d535a
Flip, ie mirror, the image or extracted region horizontally or vertically.
kusano 7d535a
.TP 
kusano 7d535a
.B \-R 90|180|270
kusano 7d535a
Rotate the image or extracted region 90, 180, or 270 degrees clockwise.
kusano 7d535a
.TP 
kusano 7d535a
.B \\-I [black|white|data|both]
kusano 7d535a
Invert color space, eg dark to light for bilevel and grayscale images.
kusano 7d535a
This can be used to modify negative images to positive or to correct
kusano 7d535a
images that have the PHOTOMETRIC_INTERPRETATIN tag set incorrectly.
kusano 7d535a
If the value is black or white, the PHOTOMETRIC_INTERPRETATION tag is set to 
kusano 7d535a
MinIsBlack or MinIsWhite, without altering the image data. If the argument 
kusano 7d535a
is data or both, the data values of the image are modified. Specifying both 
kusano 7d535a
inverts the data and the PHOTOMETRIC_INTERPRETATION tag, whereas using data
kusano 7d535a
inverts the data but not the PHOTOMETRIC_INTERPRETATION tag.
kusano 7d535a
No support for modifying the color space of color images in this release.
kusano 7d535a
.TP 
kusano 7d535a
.B \-H #
kusano 7d535a
Set the horizontal resolution of output images to #
kusano 7d535a
expressed in the current units.
kusano 7d535a
.TP 
kusano 7d535a
.B \-V #
kusano 7d535a
Set the vertical resolution of the output images to #
kusano 7d535a
expressed in the current units.
kusano 7d535a
.TP 
kusano 7d535a
.B \-J #
kusano 7d535a
Set the horizontal margin of an output page size to #
kusano 7d535a
expressed in the current units when sectioning image into columns x rows
kusano 7d535a
subimages using the \-S cols:rows option.
kusano 7d535a
.TP 
kusano 7d535a
.B \-K #
kusano 7d535a
Set the vertical margin of an output page size to # 
kusano 7d535a
expressed in the current units when sectioning image into columns x rows
kusano 7d535a
submiages using the \-S cols:rows option.
kusano 7d535a
.TP
kusano 7d535a
.B \-O portrait|landscape|auto
kusano 7d535a
Set the output orientation of the pages or sections.
kusano 7d535a
Auto will use the arrangement that requires the fewest pages.
kusano 7d535a
This option is only meaningful in conjunction with the -P
kusano 7d535a
option to format an image to fit on a specific paper size.
kusano 7d535a
.TP 
kusano 7d535a
.B \-P page
kusano 7d535a
Format the output images to fit on page size paper. Use
kusano 7d535a
\-P list to show the supported page sizes and dimensions.
kusano 7d535a
You can define a custom page size by entering the width and length of the
kusano 7d535a
page in the current units with the following format #.#x#.#.
kusano 7d535a
.TP 
kusano 7d535a
.B \-S cols:rows
kusano 7d535a
Divide each image into cols across and rows down equal sections.
kusano 7d535a
.TP 
kusano 7d535a
.B \-B
kusano 7d535a
Force output to be written with Big\-Endian byte order.
kusano 7d535a
This option only has an effect when the output file is created or
kusano 7d535a
overwritten and not when it is appended to.
kusano 7d535a
.TP 
kusano 7d535a
.B \-C
kusano 7d535a
Suppress the use of ``strip chopping'' when reading images
kusano 7d535a
that have a single strip/tile of uncompressed data.
kusano 7d535a
.TP 
kusano 7d535a
.B \-c
kusano 7d535a
Specify the compression to use for data written to the output file:
kusano 7d535a
.B none 
kusano 7d535a
for no compression,
kusano 7d535a
.B packbits
kusano 7d535a
for PackBits compression,
kusano 7d535a
.B lzw
kusano 7d535a
for Lempel\-Ziv & Welch compression,
kusano 7d535a
.B jpeg 
kusano 7d535a
for baseline JPEG compression.
kusano 7d535a
.B zip
kusano 7d535a
for Deflate compression,
kusano 7d535a
.B g3
kusano 7d535a
for CCITT Group 3 (T.4) compression,
kusano 7d535a
and
kusano 7d535a
.B g4
kusano 7d535a
for CCITT Group 4 (T.6) compression.
kusano 7d535a
By default
kusano 7d535a
.I tiffcrop
kusano 7d535a
will compress data according to the value of the
kusano 7d535a
.I Compression
kusano 7d535a
tag found in the source file.
kusano 7d535a
.IP 
kusano 7d535a
The
kusano 7d535a
.SM CCITT
kusano 7d535a
Group 3 and Group 4 compression algorithms can only
kusano 7d535a
be used with bilevel data.
kusano 7d535a
.IP 
kusano 7d535a
Group 3 compression can be specified together with several
kusano 7d535a
T.4\-specific options:
kusano 7d535a
.B 1d
kusano 7d535a
for 1\-dimensional encoding,
kusano 7d535a
.B 2d
kusano 7d535a
for 2\-dimensional encoding,
kusano 7d535a
and
kusano 7d535a
.B fill
kusano 7d535a
to force each encoded scanline to be zero\-filled so that the
kusano 7d535a
terminating EOL code lies on a byte boundary.
kusano 7d535a
Group 3\-specific options are specified by appending a ``:''\-separated
kusano 7d535a
list to the ``g3'' option; e.g.
kusano 7d535a
.B "\-c g3:2d:fill"
kusano 7d535a
to get 2D\-encoded data with byte\-aligned EOL codes.
kusano 7d535a
.IP 
kusano 7d535a
.SM LZW
kusano 7d535a
compression can be specified together with a 
kusano 7d535a
.I predictor
kusano 7d535a
value.
kusano 7d535a
A predictor value of 2 causes
kusano 7d535a
each scanline of the output image to undergo horizontal
kusano 7d535a
differencing before it is encoded; a value
kusano 7d535a
of 1 forces each scanline to be encoded without differencing.
kusano 7d535a
LZW\-specific options are specified by appending a ``:''\-separated
kusano 7d535a
list to the ``lzw'' option; e.g.
kusano 7d535a
.B "\-c lzw:2"
kusano 7d535a
for
kusano 7d535a
.SM LZW
kusano 7d535a
compression with horizontal differencing.
kusano 7d535a
.TP 
kusano 7d535a
.B \-f
kusano 7d535a
Specify the bit fill order to use in writing output data.
kusano 7d535a
By default,
kusano 7d535a
.I tiffcrop
kusano 7d535a
will create a new file with the same fill order as the original.
kusano 7d535a
Specifying
kusano 7d535a
.B "\-f lsb2msb"
kusano 7d535a
will force data to be written with the FillOrder tag set to
kusano 7d535a
.SM LSB2MSB,
kusano 7d535a
while
kusano 7d535a
.B "\-f msb2lsb"
kusano 7d535a
will force data to be written with the FillOrder tag set to
kusano 7d535a
.SM MSB2LSB.
kusano 7d535a
.TP 
kusano 7d535a
.B \-i
kusano 7d535a
Ignore non\-fatal read errors and continue processing of the input file.
kusano 7d535a
.TP 
kusano 7d535a
.B \-l
kusano 7d535a
Specify the length of a tile (in pixels).
kusano 7d535a
.I Tiffcrop
kusano 7d535a
attempts to set the tile dimensions so
kusano 7d535a
that no more than 8 kilobytes of data appear in a tile.
kusano 7d535a
.TP 
kusano 7d535a
.B \-L
kusano 7d535a
Force output to be written with Little\-Endian byte order.
kusano 7d535a
This option only has an effect when the output file is created or
kusano 7d535a
overwritten and not when it is appended to.
kusano 7d535a
.TP 
kusano 7d535a
.B \-M
kusano 7d535a
Suppress the use of memory\-mapped files when reading images.
kusano 7d535a
.TP 
kusano 7d535a
.B \-p
kusano 7d535a
Specify the planar configuration to use in writing image data
kusano 7d535a
that has more than one sample per pixel.
kusano 7d535a
By default,
kusano 7d535a
.I tiffcrop
kusano 7d535a
will create a new file with the same planar configuration as
kusano 7d535a
the original.
kusano 7d535a
Specifying
kusano 7d535a
.B "\-p contig"
kusano 7d535a
will force data to be written with multi\-sample data packed
kusano 7d535a
together, while
kusano 7d535a
.B "\-p separate"
kusano 7d535a
will force samples to be written in separate planes.
kusano 7d535a
.TP 
kusano 7d535a
.B \-r
kusano 7d535a
Specify the number of rows (scanlines) in each strip of data
kusano 7d535a
written to the output file.
kusano 7d535a
By default (or when value
kusano 7d535a
.B 0
kusano 7d535a
is specified),
kusano 7d535a
.I tiffcrop
kusano 7d535a
attempts to set the rows/strip that no more than 8 kilobytes of 
kusano 7d535a
data appear in a strip. If you specify the special value
kusano 7d535a
.B \-1
kusano 7d535a
it will results in infinite number of the rows per strip. The entire image
kusano 7d535a
will be the one strip in that case.
kusano 7d535a
.TP 
kusano 7d535a
.B \-s
kusano 7d535a
Force the output file to be written with data organized in strips
kusano 7d535a
(rather than tiles).
kusano 7d535a
.TP 
kusano 7d535a
.B \-t
kusano 7d535a
Force the output file to be written with data organized in tiles
kusano 7d535a
(rather than strips).
kusano 7d535a
.TP 
kusano 7d535a
.B \-w
kusano 7d535a
Specify the width of a tile (in pixels).
kusano 7d535a
.I tiffcrop
kusano 7d535a
attempts to set the tile dimensions so
kusano 7d535a
that no more than 8 kilobytes of data appear in a tile.
kusano 7d535a
.I tiffcrop
kusano 7d535a
attempts to set the tile dimensions so
kusano 7d535a
that no more than 8 kilobytes of data appear in a tile.
kusano 7d535a
.TP
kusano 7d535a
Debug and dump facility
kusano 7d535a
.B \-D opt1:value1,opt2:value2,opt3:value3:opt4:value4
kusano 7d535a
Display program progress and/or dump raw data to non\-TIFF files.
kusano 7d535a
Options include the following and must be joined as a comma
kusano 7d535a
separated list. The use of this option is generally limited to
kusano 7d535a
program debugging and development of future options. An equal sign
kusano 7d535a
may be substituted for the colon in option:value pairs.
kusano 7d535a
.IP
kusano 7d535a
debug:N         Display limited program progress indicators where larger N
kusano 7d535a
increase the level of detail.
kusano 7d535a
.IP
kusano 7d535a
format:txt|raw  Format any logged data as ASCII text or raw binary 
kusano 7d535a
values. ASCII text dumps include strings of ones and zeroes representing
kusano 7d535a
the binary values in the image data plus identifying headers.
kusano 7d535a
.IP
kusano 7d535a
level:N         Specify the level of detail presented in the dump files.
kusano 7d535a
This can vary from dumps of the entire input or output image data to dumps
kusano 7d535a
of data processed by specific functions. Current range of levels is 1 to 3.
kusano 7d535a
.IP
kusano 7d535a
input:full\-path\-to\-directory/input\-dumpname
kusano 7d535a
.IP
kusano 7d535a
output:full\-path\-to\-directory/output\-dumpname
kusano 7d535a
.IP
kusano 7d535a
When dump files are being written, each image will be written to a separate
kusano 7d535a
file with the name built by adding a numeric sequence value to the dumpname
kusano 7d535a
and an extension of .txt for ASCII dumps or .bin for binary dumps.
kusano 7d535a
kusano 7d535a
The four debug/dump options are independent, though it makes little sense to
kusano 7d535a
specify a dump file without specifying a detail level.
kusano 7d535a
.IP
kusano 7d535a
Note: Tiffcrop may be compiled with -DDEVELMODE to enable additional very
kusano 7d535a
 low level debug reporting.
kusano 7d535a
.SH "EXAMPLES"
kusano 7d535a
The following concatenates two files and writes the result using 
kusano 7d535a
.SM LZW
kusano 7d535a
encoding:
kusano 7d535a
.RS
kusano 7d535a
.nf 
kusano 7d535a
tiffcrop \-c lzw a.tif b.tif result.tif
kusano 7d535a
.fi 
kusano 7d535a
.RE
kusano 7d535a
.PP 
kusano 7d535a
To convert a G3 1d\-encoded 
kusano 7d535a
.SM TIFF
kusano 7d535a
to a single strip of G4\-encoded data the following might be used:
kusano 7d535a
.RS
kusano 7d535a
.nf 
kusano 7d535a
tiffcrop \-c g4 \-r 10000 g3.tif g4.tif
kusano 7d535a
.fi 
kusano 7d535a
.RE
kusano 7d535a
(1000 is just a number that is larger than the number of rows in
kusano 7d535a
the source file.)
kusano 7d535a
kusano 7d535a
To extract a selected set of images from a multi\-image TIFF file 
kusano 7d535a
use the \-N option described above. Thus, to copy the 1st and 3rd
kusano 7d535a
images of image file "album.tif" to "result.tif":
kusano 7d535a
.RS
kusano 7d535a
.nf 
kusano 7d535a
tiffcrop \-N 1,3 album.tif result.tif
kusano 7d535a
.fi 
kusano 7d535a
.RE
kusano 7d535a
.PP 
kusano 7d535a
Invert a bilevel image scan of a microfilmed document and crop off margins of
kusano 7d535a
0.25 inches on the left and right, 0.5 inch on the top, and 0.75 inch on the
kusano 7d535a
bottom. From the remaining portion of the image, select the second and third
kusano 7d535a
quarters, ie, one half of the area left from the center to each margin. 
kusano 7d535a
.RS
kusano 7d535a
tiffcrop \-U in \-m 0.5,0.25,0.75,0.25 \-E left \-Z 2:4,3:4 \-I both MicrofilmNegative.tif MicrofilmPostiveCenter.tif
kusano 7d535a
.fi 
kusano 7d535a
.RE
kusano 7d535a
.PP 
kusano 7d535a
Extract only the final image of a large Architectural E sized 
kusano 7d535a
multipage TIFF file and rotate it 90 degrees clockwise while 
kusano 7d535a
reformatting the output to fit on tabloid sized sheets with one 
kusano 7d535a
quarter of an inch on each side:
kusano 7d535a
.RS
kusano 7d535a
tiffcrop \-N last \-R 90 \-O auto \-P tabloid \-U in \-J 0.25 \-K 0.25 \-H 300 \-V 300 Big\-PlatMap.tif BigPlatMap\-Tabloid.tif 
kusano 7d535a
.fi 
kusano 7d535a
.RE
kusano 7d535a
The output images will have a specified resolution of 300 dpi in both
kusano 7d535a
directions. The orientation of each page will be determined by whichever
kusano 7d535a
choice requires the fewest pages. To specify a specific orientation, use
kusano 7d535a
the portrait or landscape option. The paper size option does not resample
kusano 7d535a
the image. It breaks each original image into a series of smaller images
kusano 7d535a
that will fit on the target paper size at the specified resolution.
kusano 7d535a
.fi 
kusano 7d535a
.RE
kusano 7d535a
.PP 
kusano 7d535a
Extract two regions 2048 pixels wide by 2048 pixels high from each page of
kusano 7d535a
a multi\-page input file and write each region to a separate output file.
kusano 7d535a
.RS
kusano 7d535a
tiffcrop \-U px \-z 1,1,2048,2048:1,2049,2048,4097 \-e separate  CheckScans.tiff Check
kusano 7d535a
.fi 
kusano 7d535a
.RE
kusano 7d535a
The output file names will use the stem Check with a numeric suffix which is
kusano 7d535a
incremented for each region of each image, eg Check\-001.tiff, Check\-002.tiff ...
kusano 7d535a
Check\-NNN.tiff. To produce a unique file for each page of the input image
kusano 7d535a
with one new image for each region of the input image on that page, change
kusano 7d535a
the export option to \-e multiple.
kusano 7d535a
kusano 7d535a
.SH "NOTES"
kusano 7d535a
.PP 
kusano 7d535a
In general, bilevel, grayscale, palette and RGB(A) data with bit depths
kusano 7d535a
from 1 to 32 bits should work in both interleaved and separate plane
kusano 7d535a
formats. Unlike tiffcp, tiffcrop can read and write tiled images with
kusano 7d535a
bits per sample that are not a multiple of 8 in both interleaved and
kusano 7d535a
separate planar format. Floating point data types are supported at 
kusano 7d535a
bit depts of 16, 24, 32 and 64 bits per sample. 
kusano 7d535a
.PP
kusano 7d535a
Not all images can be converted from one compression scheme to another.
kusano 7d535a
Data with some photometric interpretations and/or bit depths are tied to 
kusano 7d535a
specific compression schemes and vice-versa, e.g. Group 3/4 compression
kusano 7d535a
is only usable for bilevel data. JPEG compression is only usable on 8
kusano 7d535a
bit per sample data (or 12 bit if 
kusano 7d535a
.I LibTIFF
kusano 7d535a
was compiled with 12 bit JPEG support). Support for OJPEG compressed 
kusano 7d535a
images is problematic at best. Since OJPEG compression is no longer 
kusano 7d535a
supported for writing images with LibTIFF, these images will be updated
kusano 7d535a
to the newer JPEG compression when they are copied or processed. This
kusano 7d535a
may cause the image to appear color shifted or distorted after conversion.
kusano 7d535a
In some cases, it is possible to remove the original compression from 
kusano 7d535a
image data using the option -cnone.
kusano 7d535a
.PP
kusano 7d535a
Tiffcrop does not currently provide options to up or downsample data to 
kusano 7d535a
different bit depths or convert data from one photometric interpretation 
kusano 7d535a
to another, e.g. 16 bits per sample to 8 bits per sample or RGB to grayscale. 
kusano 7d535a
.PP
kusano 7d535a
Tiffcrop is very loosely derived from code in
kusano 7d535a
.I tiffcp
kusano 7d535a
with extensive modifications and additions to support the selection of input 
kusano 7d535a
images and regions and the exporting of them to one or more output files in 
kusano 7d535a
various groupings. The image manipulation routines are entirely new and 
kusano 7d535a
additional ones may be added in the future. It will handle tiled images with 
kusano 7d535a
bit depths that are not a multiple of eight that tiffcp may refuse to read.
kusano 7d535a
.PP 
kusano 7d535a
.I Tiffcrop
kusano 7d535a
was designed to handle large files containing many moderate sized images 
kusano 7d535a
with memory usage that is independent of the number of images in the file. 
kusano 7d535a
In order to support compression modes that are not based on individual 
kusano 7d535a
scanlines, e.g. JPEG, it now reads images by strip or tile rather than by 
kusano 7d535a
indvidual scanlines. In addition to the memory required by the input and 
kusano 7d535a
output buffers associated with
kusano 7d535a
.I LibTIFF
kusano 7d535a
one or more buffers at least as large as the largest image to be read are
kusano 7d535a
required. The design favors large volume document processing uses over 
kusano 7d535a
scientific or graphical manipulation of large datasets as might be found 
kusano 7d535a
in research or remote sensing scenarios.
kusano 7d535a
.SH "SEE ALSO"
kusano 7d535a
.BR pal2rgb (1),
kusano 7d535a
.BR tiffinfo (1),
kusano 7d535a
.BR tiffcmp (1),
kusano 7d535a
.BR tiffcp (1),
kusano 7d535a
.BR tiffmedian (1),
kusano 7d535a
.BR tiffsplit (1),
kusano 7d535a
.BR libtiff (3TIFF)
kusano 7d535a
.PP 
kusano 7d535a
Libtiff library home page:
kusano 7d535a
.BR http://www.remotesensing.org/libtiff/
kusano 7d535a