File: C:/Users/fred/anaconda3/Library/share/doc/tiff/manual/html/tools/tiffcrop.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>tiffcrop — LibTIFF 4.5.1 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/sphinxdoc.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/sphinx_highlight.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="tiffdither" href="tiffdither.html" />
<link rel="prev" title="tiffcp" href="tiffcp.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="tiffdither.html" title="tiffdither"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="tiffcp.html" title="tiffcp"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">LibTIFF 4.5.1 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../tools.html" accesskey="U">TIFF Tools Overview</a> »</li>
<li class="nav-item nav-item-this"><a href="">tiffcrop</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="tiffcrop">
<h1>tiffcrop<a class="headerlink" href="#tiffcrop" title="Permalink to this heading">¶</a></h1>
<section id="synopsis">
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Permalink to this heading">¶</a></h2>
<p><strong>tiffcrop</strong> [ <em>options</em> ] <em>src1.tif</em> … <em>srcN.tif</em> <em>dst.tif</em></p>
</section>
<section id="description">
<h2>Description<a class="headerlink" href="#description" title="Permalink to this heading">¶</a></h2>
<p><strong class="program">tiffcrop</strong> processes one or more files created according
to the Tag Image File Format, Revision 6.0, specification
into one or more TIFF file(s).
<strong class="program">tiffcrop</strong> is most often used to extract portions of an image for processing
with bar code recognizer 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 processed 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.</p>
<p>The available functions can be grouped broadly into three classes:</p>
<ol class="arabic simple">
<li><p>Those that select individual images or sections of images from the input files.
The options <a class="reference internal" href="#cmdoption-tiffcrop-N"><code class="xref std std-option docutils literal notranslate"><span class="pre">-N</span></code></a> for sequences or lists of individual images in the input files,
<a class="reference internal" href="#cmdoption-tiffcrop-Z"><code class="xref std std-option docutils literal notranslate"><span class="pre">-Z</span></code></a> for zones, <a class="reference internal" href="#cmdoption-tiffcrop-z"><code class="xref std std-option docutils literal notranslate"><span class="pre">-z</span></code></a> for regions, <a class="reference internal" href="#cmdoption-tiffcrop-X"><code class="xref std std-option docutils literal notranslate"><span class="pre">-X</span></code></a> and <a class="reference internal" href="#cmdoption-tiffcrop-Y"><code class="xref std std-option docutils literal notranslate"><span class="pre">-Y</span></code></a> for fixed sized selections,
<a class="reference internal" href="#cmdoption-tiffcrop-m"><code class="xref std std-option docutils literal notranslate"><span class="pre">-m</span></code></a> for margins, <a class="reference internal" href="#cmdoption-tiffcrop-U"><code class="xref std std-option docutils literal notranslate"><span class="pre">-U</span></code></a> for units, and <a class="reference internal" href="#cmdoption-tiffcrop-E"><code class="xref std std-option docutils literal notranslate"><span class="pre">-E</span></code></a> for edge reference provide a variety of
ways to specify portions of the input image.</p></li>
<li><p>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 <a class="reference internal" href="#cmdoption-tiffcrop-P"><code class="xref std std-option docutils literal notranslate"><span class="pre">-P</span></code></a> for page size grouping, <a class="reference internal" href="#cmdoption-tiffcrop-S"><code class="xref std std-option docutils literal notranslate"><span class="pre">-S</span></code></a> for
subdivision into columns and rows and <a class="reference internal" href="#cmdoption-tiffcrop-e"><code class="xref std std-option docutils literal notranslate"><span class="pre">-e</span></code></a> for export mode options that produce
one or more files from each input image. The options <a class="reference internal" href="#cmdoption-tiffcrop-r"><code class="xref std std-option docutils literal notranslate"><span class="pre">-r</span></code></a>, <a class="reference internal" href="#cmdoption-tiffcrop-s"><code class="xref std std-option docutils literal notranslate"><span class="pre">-s</span></code></a>, <a class="reference internal" href="#cmdoption-tiffcrop-t"><code class="xref std std-option docutils literal notranslate"><span class="pre">-t</span></code></a>, <a class="reference internal" href="#cmdoption-tiffcrop-w"><code class="xref std std-option docutils literal notranslate"><span class="pre">-w</span></code></a> control
strip and tile format and sizes while <a class="reference internal" href="#cmdoption-tiffcrop-B"><code class="xref std std-option docutils literal notranslate"><span class="pre">-B</span></code></a>, <a class="reference internal" href="#cmdoption-tiffcrop-L"><code class="xref std std-option docutils literal notranslate"><span class="pre">-L</span></code></a>, <a class="reference internal" href="#cmdoption-tiffcrop-c"><code class="xref std std-option docutils literal notranslate"><span class="pre">-c</span></code></a>, <a class="reference internal" href="#cmdoption-tiffcrop-f"><code class="xref std std-option docutils literal notranslate"><span class="pre">-f</span></code></a> modify the endian addressing
scheme, the compression options, and the bit fill sequence of images as they
are written.</p></li>
<li><p>Those that perform some action on each image that is selected from the input file.
The options include <a class="reference internal" href="#cmdoption-tiffcrop-R"><code class="xref std std-option docutils literal notranslate"><span class="pre">-R</span></code></a> for rotate, <a class="reference internal" href="#cmdoption-tiffcrop-I"><code class="xref std std-option docutils literal notranslate"><span class="pre">-I</span></code></a> for inversion of the photometric
interpretation and/or data values, and <a class="reference internal" href="#cmdoption-tiffcrop-F"><code class="xref std std-option docutils literal notranslate"><span class="pre">-F</span></code></a> to flip (mirror) the image horizontally
or vertically.</p></li>
</ol>
<p>Functions are applied to the input image(s) in the following order:
cropping, fixed area extraction, zone and region extraction,
inversion, mirroring, rotation.</p>
<p>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, <em>or</em> row and column divisions with output margins,
<em>or</em> page size divisions with page orientation options.</p>
<p>Finally, strip, tile, byte order, output resolution, and compression options are
applied to all output images.</p>
<p>The output file(s) may be organized and compressed using a different
algorithm from the input files.
By default, <strong class="program">tiffcrop</strong> 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.</p>
<p><strong class="program">tiffcrop</strong> can be used to reorganize the storage characteristics of data
in a file, and to reorganize, extract, rotate, and otherwise
process the image data as specified at the same time whereas
<strong class="program">tiffcp</strong> does not alter the image data within the file.</p>
<p>Using the options for selecting individual input images and the
options for exporting images and/or segments defined as zones or
regions of each input image, <strong class="program">tiffcrop</strong> can perform the
functions of <strong class="program">tiffcp</strong> and <strong class="program">tiffsplit</strong> in a single pass
while applying multiple operations to individual selections or images.</p>
</section>
<section id="options">
<h2>Options<a class="headerlink" href="#options" title="Permalink to this heading">¶</a></h2>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-h">
<span class="sig-name descname"><span class="pre">-h</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-h" title="Permalink to this definition">¶</a></dt>
<dd><p>Display the syntax summary for tiffcrop.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-v">
<span class="sig-name descname"><span class="pre">-v</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-v" title="Permalink to this definition">¶</a></dt>
<dd><p>Report the current version and last modification date for tiffcrop.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-N">
<span class="sig-name descname"><span class="pre">-N</span></span><span class="sig-prename descclassname"> <span class="pre">odd|even|#,#-#,#|last</span></span><a class="headerlink" href="#cmdoption-tiffcrop-N" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify one or more series or range(s) of images within each file to process.
The words <code class="docutils literal notranslate"><span class="pre">odd</span></code> or <code class="docutils literal notranslate"><span class="pre">even</span></code>
may be used to specify all odd or even numbered images counting from one.
Note that internally, TIFF images are numbered from zero rather than one
but since this convention is not obvious to most users, <strong class="program">tiffcrop</strong> used 1
to specify the first image in a multipage file. The word <code class="docutils literal notranslate"><span class="pre">last</span></code>
may be used in place of a number in the sequence to indicate the
final image in the file without knowing how many images there are.
Ranges of images may be specified with a dash and multiple sets
can be indicated by joining them in a comma-separated list. eg. use
<code class="docutils literal notranslate"><span class="pre">-N</span> <span class="pre">1,5-7,last</span></code>
to process the 1st, 5th through 7th, and final image in the file.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-E">
<span class="sig-name descname"><span class="pre">-E</span></span><span class="sig-prename descclassname"> <span class="pre">top|bottom|left|right</span></span><a class="headerlink" href="#cmdoption-tiffcrop-E" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify the <code class="docutils literal notranslate"><span class="pre">top</span></code>, <code class="docutils literal notranslate"><span class="pre">bottom</span></code>, <code class="docutils literal notranslate"><span class="pre">left</span></code>, or <code class="docutils literal notranslate"><span class="pre">right</span></code> edge as the reference from
which to calculate the width and length of crop regions or sequence
of positions for zones. When used with the <a class="reference internal" href="#cmdoption-tiffcrop-e"><code class="xref std std-option docutils literal notranslate"><span class="pre">-e</span></code></a> option for exporting
zones or regions, the reference edge determines how composite images
are arranged. Using <code class="docutils literal notranslate"><span class="pre">-E</span> <span class="pre">left</span></code> or <code class="docutils literal notranslate"><span class="pre">-E</span> <span class="pre">right</span></code> causes successive zones or
regions to be merged horizontally whereas using <code class="docutils literal notranslate"><span class="pre">-E</span> <span class="pre">top</span></code> or <code class="docutils literal notranslate"><span class="pre">-E</span> <span class="pre">bottom</span></code>
causes successive zones or regions to be arranged vertically. This
option has no effect on export layout when multiple zones or regions
are not being exported to composite images. Edges may be abbreviated
to the first letter.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-e">
<span class="sig-name descname"><span class="pre">-e</span></span><span class="sig-prename descclassname"> <span class="pre">combined|divided|image|multiple|separate</span></span><a class="headerlink" href="#cmdoption-tiffcrop-e" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify the export mode for images and selections from input images.
The final filename on the command line is considered to be the
destination file or filename stem for automatically generated
sequences of files. Modes may be abbreviated to the first letter.</p>
<table class="docutils align-default" id="id1">
<caption><span class="caption-text">Export modes</span><a class="headerlink" href="#id1" title="Permalink to this table">¶</a></caption>
<colgroup>
<col style="width: 20.0%" />
<col style="width: 80.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Export mode</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>combined</p></td>
<td><p>All images and selections are written to a single file with
multiple selections from one image combined into a single image (default)</p></td>
</tr>
<tr class="row-odd"><td><p>divided</p></td>
<td><p>All images and selections are written to a single file
with each selection from one image written to a new image</p></td>
</tr>
<tr class="row-even"><td><p>image</p></td>
<td><p>Each input image is written to a new file (numeric filename sequence)
with multiple selections from the image combined into one image</p></td>
</tr>
<tr class="row-odd"><td><p>multiple</p></td>
<td><p>Each input image is written to a new file (numeric filename sequence)
with each selection from the image written to a new image</p></td>
</tr>
<tr class="row-even"><td><p>separate</p></td>
<td><p>Individual selections from each image are written to separate files</p></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-U">
<span class="sig-name descname"><span class="pre">-U</span></span><span class="sig-prename descclassname"> <span class="pre">in|cm|px</span></span><a class="headerlink" href="#cmdoption-tiffcrop-U" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify the type of units to apply to dimensions for margins and
crop regions for input and output images. Inches or centimeters
are converted to pixels using the resolution unit specified in the
TIFF file (which defaults to inches if not specified in the IFD).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-m">
<span class="sig-name descname"><span class="pre">-m</span></span><span class="sig-prename descclassname"> <span class="pre">top,left,bottom,right</span></span><a class="headerlink" href="#cmdoption-tiffcrop-m" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify margins to be removed from the input image. The order must
be <em>top</em>, <em>left</em>, <em>bottom</em>, <em>right</em> with only commas separating the elements
of the list. Margins are scaled according to the current units and
removed before any other extractions are computed.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-X">
<span class="sig-name descname"><span class="pre">-X</span></span><span class="sig-prename descclassname"> <span class="pre">#</span></span><a class="headerlink" href="#cmdoption-tiffcrop-X" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the horizontal (X-axis) dimension of a region to extract relative to
the specified origin reference. If the origin is the top or bottom
edge, the X axis value will be assumed to start at the left edge.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-Y">
<span class="sig-name descname"><span class="pre">-Y</span></span><span class="sig-prename descclassname"> <span class="pre">#</span></span><a class="headerlink" href="#cmdoption-tiffcrop-Y" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the vertical (Y-axis) dimension of a region to extract relative to
the specified origin reference. If the origin is the left or right
edge, the Y axis value will be assumed to start at the top.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-Z">
<span class="sig-name descname"><span class="pre">-Z</span></span><span class="sig-prename descclassname">  <span class="pre">#:#,#:#</span></span><a class="headerlink" href="#cmdoption-tiffcrop-Z" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify zones of the image designated as position X of Y equal sized portions
measured from the reference edge, eg 1:3 would be first third of the
image starting from the reference edge minus any margins specified
for the confining edges. Multiple zones can be specified as a comma
separated list but they must reference the same edge. To extract the
top quarter and the bottom third of an image you would use
<code class="docutils literal notranslate"><span class="pre">-Z</span> <span class="pre">1:4,3:3</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-z">
<span class="sig-name descname"><span class="pre">-z</span></span><span class="sig-prename descclassname"> <span class="pre">x1,y1,x2,y2:</span> <span class="pre">...</span> <span class="pre">:xN,yN,xN+1,yN+1</span></span><a class="headerlink" href="#cmdoption-tiffcrop-z" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify a series of coordinates to define regions for processing and exporting.
The coordinates represent the top left and lower right corners of each region
in the current units, eg inch, cm, or pixels. Pixels are counted from one to
width or height and inches or cm are calculated from image resolution data.</p>
<p>Each colon delimited series of four values represents the horizontal and vertical
offsets from the top and left edges of the image, regardless of the edge specified
with the <a class="reference internal" href="#cmdoption-tiffcrop-E"><code class="xref std std-option docutils literal notranslate"><span class="pre">-E</span></code></a> option. The first and third values represent the horizontal offsets of
the corner points from the left edge while the second and fourth values represent
the vertical offsets from the top edge.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-F">
<span class="sig-name descname"><span class="pre">-F</span></span><span class="sig-prename descclassname"> <span class="pre">horiz|vert</span></span><a class="headerlink" href="#cmdoption-tiffcrop-F" title="Permalink to this definition">¶</a></dt>
<dd><p>Flip, ie mirror, the image or extracted region horizontally or vertically.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-R">
<span class="sig-name descname"><span class="pre">-R</span></span><span class="sig-prename descclassname"> <span class="pre">90|180|270</span></span><a class="headerlink" href="#cmdoption-tiffcrop-R" title="Permalink to this definition">¶</a></dt>
<dd><p>Rotate the image or extracted region 90, 180, or 270 degrees clockwise.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-I">
<span class="sig-name descname"><span class="pre">-I</span></span><span class="sig-prename descclassname"> <span class="pre">[black|white|data|both]</span></span><a class="headerlink" href="#cmdoption-tiffcrop-I" title="Permalink to this definition">¶</a></dt>
<dd><p>Invert color space, eg dark to light for bilevel and grayscale images.
This can be used to modify negative images to positive or to correct
images that have the <code class="docutils literal notranslate"><span class="pre">PHOTOMETRIC_INTERPRETATION</span></code> tag set incorrectly.
If the value is black or white, the <code class="docutils literal notranslate"><span class="pre">PHOTOMETRIC_INTERPRETATION</span></code> tag is set to
MinIsBlack or MinIsWhite, without altering the image data. If the argument
is data or both, the data values of the image are modified. Specifying both
inverts the data and the <code class="docutils literal notranslate"><span class="pre">PHOTOMETRIC_INTERPRETATION</span></code> tag, whereas using data
inverts the data but not the <code class="docutils literal notranslate"><span class="pre">PHOTOMETRIC_INTERPRETATION</span></code> tag.
No support for modifying the color space of color images in this release.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-H">
<span class="sig-name descname"><span class="pre">-H</span></span><span class="sig-prename descclassname"> <span class="pre">#</span></span><a class="headerlink" href="#cmdoption-tiffcrop-H" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the horizontal resolution of output images to <em>#</em>,
expressed in the current units.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-V">
<span class="sig-name descname"><span class="pre">-V</span></span><span class="sig-prename descclassname"> <span class="pre">#</span></span><a class="headerlink" href="#cmdoption-tiffcrop-V" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the vertical resolution of the output images to <em>#</em>
expressed in the current units.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-J">
<span class="sig-name descname"><span class="pre">-J</span></span><span class="sig-prename descclassname"> <span class="pre">#</span></span><a class="headerlink" href="#cmdoption-tiffcrop-J" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the horizontal margin of an output page size to <em>#</em>
expressed in the current units when sectioning image into <em>columns</em> × <em>rows</em>
subimages using the <a class="reference internal" href="#cmdoption-tiffcrop-S"><code class="xref std std-option docutils literal notranslate"><span class="pre">-S</span></code></a> <code class="docutils literal notranslate"><span class="pre">cols:rows</span></code> option.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-K">
<span class="sig-name descname"><span class="pre">-K</span></span><span class="sig-prename descclassname"> <span class="pre">#</span></span><a class="headerlink" href="#cmdoption-tiffcrop-K" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the vertical margin of an output page size to <em>#</em>
expressed in the current units when sectioning image into <em>columns</em> × <em>rows</em>
subimages using the <a class="reference internal" href="#cmdoption-tiffcrop-S"><code class="xref std std-option docutils literal notranslate"><span class="pre">-S</span></code></a> <code class="docutils literal notranslate"><span class="pre">cols:rows</span></code> option.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-O">
<span class="sig-name descname"><span class="pre">-O</span></span><span class="sig-prename descclassname"> <span class="pre">portrait|landscape|auto</span></span><a class="headerlink" href="#cmdoption-tiffcrop-O" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the output orientation of the pages or sections.
Auto will use the arrangement that requires the fewest pages.
This option is only meaningful in conjunction with the <a class="reference internal" href="#cmdoption-tiffcrop-P"><code class="xref std std-option docutils literal notranslate"><span class="pre">-P</span></code></a>
option to format an image to fit on a specific paper size.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-P">
<span class="sig-name descname"><span class="pre">-P</span></span><span class="sig-prename descclassname"> <span class="pre">page</span></span><a class="headerlink" href="#cmdoption-tiffcrop-P" title="Permalink to this definition">¶</a></dt>
<dd><p>Format the output images to fit on page size paper. Use
<code class="docutils literal notranslate"><span class="pre">-P</span> <span class="pre">list</span></code> to show the supported page sizes and dimensions.
You can define a custom page size by entering the width and length of the
page in the current units with the following format <code class="docutils literal notranslate"><span class="pre">#.#x#.#</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-S">
<span class="sig-name descname"><span class="pre">-S</span></span><span class="sig-prename descclassname"> <span class="pre">cols:rows</span></span><a class="headerlink" href="#cmdoption-tiffcrop-S" title="Permalink to this definition">¶</a></dt>
<dd><p>Divide each image into cols across and rows down equal sections.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-B">
<span class="sig-name descname"><span class="pre">-B</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-B" title="Permalink to this definition">¶</a></dt>
<dd><p>Force output to be written with Big-Endian byte order.
This option only has an effect when the output file is created or
overwritten and not when it is appended to.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-C">
<span class="sig-name descname"><span class="pre">-C</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-C" title="Permalink to this definition">¶</a></dt>
<dd><p>Suppress the use of “strip chopping” when reading images
that have a single strip/tile of uncompressed data.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-c">
<span class="sig-name descname"><span class="pre">-c</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-c" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify the compression to use for data written to the output file:
<strong class="command">-c none</strong> for no compression,
<strong class="command">-c packbits</strong> for PackBits compression,
<strong class="command">-c lzw</strong> for Lempel-Ziv & Welch compression,
<strong class="command">-c jpeg</strong> for baseline JPEG compression.
<strong class="command">-c zip</strong> for Deflate compression,
<strong class="command">-c g3</strong> for CCITT Group 3 (T.4) compression,
<strong class="command">-c g4</strong> for CCITT Group 4 (T.6) compression.
By default <strong class="program">tiffcrop</strong> will compress data according to the value of the
<code class="docutils literal notranslate"><span class="pre">Compression</span></code> tag found in the source file.</p>
<p>The CCITT Group 3 and Group 4 compression algorithms can only
be used with bilevel data.</p>
<p>Group 3 compression can be specified together with several
T.4-specific options:
<code class="docutils literal notranslate"><span class="pre">1d</span></code> for 1-dimensional encoding,
<code class="docutils literal notranslate"><span class="pre">2d</span></code> for 2-dimensional encoding,
<code class="docutils literal notranslate"><span class="pre">fill</span></code> to force each encoded scanline to be zero-filled so that the
terminating EOL code lies on a byte boundary.
Group 3-specific options are specified by appending a <code class="docutils literal notranslate"><span class="pre">:</span></code>-separated
list to the <code class="docutils literal notranslate"><span class="pre">g3</span></code> option; e.g. <code class="docutils literal notranslate"><span class="pre">-c</span> <span class="pre">g3:2d:fill</span></code>
to get 2D-encoded data with byte-aligned EOL codes.</p>
<p>LZW compression can be specified together with a <code class="docutils literal notranslate"><span class="pre">predictor</span></code>
value. A predictor value of 2 causes
each scanline of the output image to undergo horizontal
differencing before it is encoded; a value
of 1 forces each scanline to be encoded without differencing.
LZW-specific options are specified by appending a <code class="docutils literal notranslate"><span class="pre">:</span></code>-separated
list to the <code class="docutils literal notranslate"><span class="pre">lzw</span></code> option; e.g. <code class="docutils literal notranslate"><span class="pre">-c</span> <span class="pre">lzw:2</span></code> for LZW
compression with horizontal differencing.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-f">
<span class="sig-name descname"><span class="pre">-f</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-f" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify the bit fill order to use in writing output data.
By default, <strong class="program">tiffcrop</strong>
will create a new file with the same fill order as the original.
Specifying
<code class="docutils literal notranslate"><span class="pre">-f</span> <span class="pre">lsb2msb</span></code>
will force data to be written with the <code class="docutils literal notranslate"><span class="pre">FillOrder</span></code> tag set to
<code class="docutils literal notranslate"><span class="pre">LSB2MSB</span></code>, while
<code class="docutils literal notranslate"><span class="pre">-f</span> <span class="pre">msb2lsb</span></code> will force data to be written with the <code class="docutils literal notranslate"><span class="pre">FillOrder</span></code>
tag set to <code class="docutils literal notranslate"><span class="pre">MSB2LSB</span></code>.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-i">
<span class="sig-name descname"><span class="pre">-i</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-i" title="Permalink to this definition">¶</a></dt>
<dd><p>Ignore non-fatal read errors and continue processing of the input file.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-k">
<span class="sig-name descname"><span class="pre">-k</span></span><span class="sig-prename descclassname"> <span class="pre">size</span></span><a class="headerlink" href="#cmdoption-tiffcrop-k" title="Permalink to this definition">¶</a></dt>
<dd><p>Set maximum memory allocation size (in MiB). The default is 256MiB.
Set to 0 to disable the limit.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-l">
<span class="sig-name descname"><span class="pre">-l</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-l" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify the length of a tile (in pixels).
<strong class="program">tiffcrop</strong> attempts to set the tile dimensions so
that no more than 8 kilobytes of data appear in a tile.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-L">
<span class="sig-name descname"><span class="pre">-L</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-L" title="Permalink to this definition">¶</a></dt>
<dd><p>Force output to be written with Little-Endian byte order.
This option only has an effect when the output file is created or
overwritten and not when it is appended to.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-M">
<span class="sig-name descname"><span class="pre">-M</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-M" title="Permalink to this definition">¶</a></dt>
<dd><p>Suppress the use of memory-mapped files when reading images.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-p">
<span class="sig-name descname"><span class="pre">-p</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-p" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify the planar configuration to use in writing image data
that has more than one sample per pixel.
By default, <strong class="program">tiffcrop</strong>
will create a new file with the same planar configuration as
the original.
Specifying <strong class="command">-p contig</strong>
will force data to be written with multi-sample data packed
together, while
<strong class="command">-p separate</strong>
will force samples to be written in separate planes.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-r">
<span class="sig-name descname"><span class="pre">-r</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-r" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify the number of rows (scanlines) in each strip of data
written to the output file.
By default (or when value <strong>0</strong> is specified), <strong class="program">tiffcrop</strong>
attempts to set the rows/strip that no more than 8 kilobytes of
data appear in a strip. If you specify the special value
<strong>-1</strong> it will results in infinite number of the rows per strip. The entire image
will be the one strip in that case.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-s">
<span class="sig-name descname"><span class="pre">-s</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-s" title="Permalink to this definition">¶</a></dt>
<dd><p>Force the output file to be written with data organized in strips
(rather than tiles).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-t">
<span class="sig-name descname"><span class="pre">-t</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-t" title="Permalink to this definition">¶</a></dt>
<dd><p>Force the output file to be written with data organized in tiles
(rather than strips).</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-w">
<span class="sig-name descname"><span class="pre">-w</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-tiffcrop-w" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify the width of a tile (in pixels).
<strong class="program">tiffcrop</strong> attempts to set the tile dimensions so
that no more than 8 kilobytes of data appear in a tile.</p>
</dd></dl>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-tiffcrop-D">
<span class="sig-name descname"><span class="pre">-D</span></span><span class="sig-prename descclassname"> <span class="pre">opt1:value1,opt2:value2,opt3:value3:opt4:value4</span></span><a class="headerlink" href="#cmdoption-tiffcrop-D" title="Permalink to this definition">¶</a></dt>
<dd><p>Debug and dump facility</p>
<p>Display program progress and/or dump raw data to non-TIFF files.
Options include the following and must be joined as a comma
separated list. The use of this option is generally limited to
program debugging and development of future options. An equal sign
may be substituted for the colon in option:value pairs.</p>
<p><code class="docutils literal notranslate"><span class="pre">debug:N</span></code>:</p>
<blockquote>
<div><p>Display limited program progress indicators where larger <em>N</em>
increases the level of detail.</p>
</div></blockquote>
<p><code class="docutils literal notranslate"><span class="pre">format:txt|raw</span></code>:</p>
<blockquote>
<div><p>Format any logged data as ASCII text or raw binary
values. ASCII text dumps include strings of ones and zeroes representing
the binary values in the image data plus identifying headers.</p>
</div></blockquote>
<p><code class="docutils literal notranslate"><span class="pre">level:N</span></code>:</p>
<blockquote>
<div><p>Specify the level of detail presented in the dump files.
This can vary from dumps of the entire input or output image data to dumps
of data processed by specific functions. Current range of levels is 1 to 3.</p>
</div></blockquote>
<p><code class="docutils literal notranslate"><span class="pre">input:full-path-to-directory/input-dumpname</span></code>:</p>
<p><code class="docutils literal notranslate"><span class="pre">output:full-path-to-directory/output-dumpname</span></code>:</p>
<blockquote>
<div><p>When dump files are being written, each image will be written to a separate
file with the name built by adding a numeric sequence value to the dumpname
and an extension of <code class="file docutils literal notranslate"><span class="pre">.txt</span></code> for ASCII dumps or <code class="file docutils literal notranslate"><span class="pre">.bin</span></code> for binary dumps.</p>
</div></blockquote>
<p>The four debug/dump options are independent, though it makes little sense to
specify a dump file without specifying a detail level.</p>
<p>Note: <strong class="program">tiffcrop</strong> may be compiled with <strong class="command">-DDEVELMODE</strong> to enable
additional very low level debug reporting.</p>
</dd></dl>
<p>However, not all option combinations are permitted.</p>
<blockquote>
<div><p>Note 1: The (-X|-Y), -Z, -z and -S options are mutually exclusive.
In no case should the options be applied to a given selection successively.</p>
<p>Note 2: Any of the -X, -Y, -Z and -z options together with other PAGE_MODE_x options
such as -H, -V, -P, -J or -K are not supported and may cause buffer overflows.</p>
</div></blockquote>
</section>
<section id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this heading">¶</a></h2>
<p>The following concatenates two files and writes the result using LZW
encoding:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>tiffcrop<span class="w"> </span>-c<span class="w"> </span>lzw<span class="w"> </span>a.tif<span class="w"> </span>b.tif<span class="w"> </span>result.tif
</pre></div>
</div>
<p>To convert a G3 1d-encoded TIFF to a single strip of G4-encoded data the following might be used:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>tiffcrop<span class="w"> </span>-c<span class="w"> </span>g4<span class="w"> </span>-r<span class="w"> </span><span class="m">10000</span><span class="w"> </span>g3.tif<span class="w"> </span>g4.tif
</pre></div>
</div>
<p>(1000 is just a number that is larger than the number of rows in
the source file.)</p>
<p>To extract a selected set of images from a multi-image TIFF file
use the <a class="reference internal" href="#cmdoption-tiffcrop-N"><code class="xref std std-option docutils literal notranslate"><span class="pre">-N</span></code></a> option described above. Thus, to copy the 1st and 3rd
images of image file <code class="file docutils literal notranslate"><span class="pre">album.tif</span></code> to <code class="file docutils literal notranslate"><span class="pre">result.tif</span></code>:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>tiffcrop<span class="w"> </span>-N<span class="w"> </span><span class="m">1</span>,3<span class="w"> </span>album.tif<span class="w"> </span>result.tif
</pre></div>
</div>
<p>Invert a bilevel image scan of a microfilmed document and crop off margins of
0.25 inches on the left and right, 0.5 inch on the top, and 0.75 inch on the
bottom. From the remaining portion of the image, select the second and third
quarters, ie, one half of the area left from the center to each margin:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>tiffcrop<span class="w"> </span>-U<span class="w"> </span><span class="k">in</span><span class="w"> </span>-m<span class="w"> </span><span class="m">0</span>.5,0.25,0.75,0.25<span class="w"> </span>-E<span class="w"> </span>left<span class="w"> </span>-Z<span class="w"> </span><span class="m">2</span>:4,3:4<span class="w"> </span>-I<span class="w"> </span>both<span class="w"> </span>MicrofilmNegative.tif<span class="w"> </span>MicrofilmPostiveCenter.tif
</pre></div>
</div>
<p>Extract only the final image of a large Architectural E sized
multipage TIFF file and rotate it 90 degrees clockwise while
reformatting the output to fit on tabloid sized sheets with one
quarter of an inch on each side:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>tiffcrop<span class="w"> </span>-N<span class="w"> </span>last<span class="w"> </span>-R<span class="w"> </span><span class="m">90</span><span class="w"> </span>-O<span class="w"> </span>auto<span class="w"> </span>-P<span class="w"> </span>tabloid<span class="w"> </span>-U<span class="w"> </span><span class="k">in</span><span class="w"> </span>-J<span class="w"> </span><span class="m">0</span>.25<span class="w"> </span>-K<span class="w"> </span><span class="m">0</span>.25<span class="w"> </span>-H<span class="w"> </span><span class="m">300</span><span class="w"> </span>-V<span class="w"> </span><span class="m">300</span><span class="w"> </span>Big-PlatMap.tif<span class="w"> </span>BigPlatMap-Tabloid.tif
</pre></div>
</div>
<p>The output images will have a specified resolution of 300 dpi in both
directions. The orientation of each page will be determined by whichever
choice requires the fewest pages. To specify a specific orientation, use
the portrait or landscape option. The paper size option does not resample
the image. It breaks each original image into a series of smaller images
that will fit on the target paper size at the specified resolution.</p>
<p>Extract two regions 2048 pixels wide by 2048 pixels high from each page of
a multi-page input file and write each region to a separate output file:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>tiffcrop<span class="w"> </span>-U<span class="w"> </span>px<span class="w"> </span>-z<span class="w"> </span><span class="m">1</span>,1,2048,2048:1,2049,2048,4097<span class="w"> </span>-e<span class="w"> </span>separate<span class="w"> </span>CheckScans.tiff<span class="w"> </span>Check
</pre></div>
</div>
<p>The output file names will use the stem <code class="file docutils literal notranslate"><span class="pre">Check</span></code> with a numeric suffix which is
incremented for each region of each image, eg <code class="file docutils literal notranslate"><span class="pre">Check-001.tiff</span></code>,
<code class="file docutils literal notranslate"><span class="pre">Check-002.tiff</span></code> … <code class="file docutils literal notranslate"><span class="pre">Check-NNN.tiff</span></code>. To produce a unique file for each page
of the input image with one new image for each region of the input image on that page
change the export option to <code class="docutils literal notranslate"><span class="pre">-e</span> <span class="pre">multiple</span></code>.</p>
</section>
<section id="notes">
<h2>Notes<a class="headerlink" href="#notes" title="Permalink to this heading">¶</a></h2>
<p>In general, bilevel, grayscale, palette and RGB(A) data with bit depths
from 1 to 32 bits should work in both interleaved and separate plane
formats. Unlike <strong class="program">tiffcp</strong>, <strong class="program">tiffcrop</strong> can read and write tiled images with
bits per sample that are not a multiple of 8 in both interleaved and
separate planar format. Floating point data types are supported at
bit depths of 16, 24, 32 and 64 bits per sample.</p>
<p>Not all images can be converted from one compression scheme to another.
Data with some photometric interpretations and/or bit depths are tied to
specific compression schemes and vice-versa, e.g. Group 3/4 compression
is only usable for bilevel data. JPEG compression is only usable on 8
bit per sample data (or 12 bit if <strong class="program">libtiff</strong>
was compiled with 12 bit JPEG support). Support for OJPEG compressed
images is problematic at best. Since OJPEG compression is no longer
supported for writing images with LibTIFF, these images will be updated
to the newer JPEG compression when they are copied or processed. This
may cause the image to appear color shifted or distorted after conversion.
In some cases, it is possible to remove the original compression from
image data using the option <code class="docutils literal notranslate"><span class="pre">-c</span> <span class="pre">none</span></code>.</p>
<p><strong class="program">tiffcrop</strong> does not currently provide options to up or downsample data to
different bit depths or convert data from one photometric interpretation
to another, e.g. 16 bits per sample to 8 bits per sample or RGB to grayscale.</p>
<p><strong class="program">tiffcrop</strong> is very loosely derived from code in <strong class="program">tiffcp</strong>
with extensive modifications and additions to support the selection of input
images and regions and the exporting of them to one or more output files in
various groupings. The image manipulation routines are entirely new and
additional ones may be added in the future. It will handle tiled images with
bit depths that are not a multiple of eight that tiffcp may refuse to read.</p>
<p><strong class="program">tiffcrop</strong> was designed to handle large files containing many moderate sized images
with memory usage that is independent of the number of images in the file.
In order to support compression modes that are not based on individual
scanlines, e.g. JPEG, it now reads images by strip or tile rather than by
individual scanlines. In addition to the memory required by the input and
output buffers associated with <strong class="program">libtiff</strong>
one or more buffers at least as large as the largest image to be read are
required. The design favors large volume document processing uses over
scientific or graphical manipulation of large datasets as might be found
in research or remote sensing scenarios.</p>
</section>
<section id="see-also">
<h2>See also<a class="headerlink" href="#see-also" title="Permalink to this heading">¶</a></h2>
<p><a class="reference internal" href="pal2rgb.html"><span class="doc">pal2rgb</span></a> (1),
<a class="reference internal" href="tiffinfo.html"><span class="doc">tiffinfo</span></a> (1),
<a class="reference internal" href="tiffcmp.html"><span class="doc">tiff2cmp</span></a> (1),
<a class="reference internal" href="tiffcp.html"><span class="doc">tiffcp</span></a> (1),
<a class="reference internal" href="tiffmedian.html"><span class="doc">tiffmedian</span></a> (1),
<a class="reference internal" href="tiffsplit.html"><span class="doc">tiffsplit</span></a> (1),
<a class="reference internal" href="../functions/libtiff.html"><span class="doc">libtiff</span></a> (3tiff)</p>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div>
<h3><a href="../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">tiffcrop</a><ul>
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
<li><a class="reference internal" href="#description">Description</a></li>
<li><a class="reference internal" href="#options">Options</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#notes">Notes</a></li>
<li><a class="reference internal" href="#see-also">See also</a></li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="tiffcp.html"
title="previous chapter">tiffcp</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="tiffdither.html"
title="next chapter">tiffdither</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/tools/tiffcrop.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="tiffdither.html" title="tiffdither"
>next</a> |</li>
<li class="right" >
<a href="tiffcp.html" title="tiffcp"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">LibTIFF 4.5.1 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../tools.html" >TIFF Tools Overview</a> »</li>
<li class="nav-item nav-item-this"><a href="">tiffcrop</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 1988-2022, LibTIFF contributors.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.0.1.
</div>
</body>
</html>