man-pages/man1/tifftopnm.1.html
2021-03-31 01:06:50 +01:00

268 lines
7.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of tifftopnm</TITLE>
</HEAD><BODY>
<H1>tifftopnm</H1>
Section: User Commands (1)<BR>Updated: 02 April 2000<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="ixAAB"></A>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
tifftopnm - convert a TIFF file into a portable anymap
<P>
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>tifftopnm</B>
[<B>-alphaout=</B>{<I>alpha-filename</I>,<B>-</B>}]
[<B>-headerdump</B>]
[<B>-respectfillorder</B>]
[<I>tiff-filename</I>]
<P>
You may abbreviate any option to its shortest unique prefix. You may use
two hyphens instead of one in options. You may separate an option and
its value either by an equals sign or white space.
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Reads a TIFF file as input.
<A NAME="ixAAC"></A>
Produces a portable anymap as output.
The type of the output file depends on the input file - if it's
black &amp; white, generates a
<I>pbm</I>
file;
if it's grayscale, generates a
<I>pgm</I>
file; otherwise, a
<I>ppm</I>
file. The program tells you which type it is writing.
<P>
This program cannot read every possible TIFF file -- there are myriad
variations of the TIFF format. However, it does understand monochrome
and gray scale, RGB, RGBA (red/green/blue with alpha channel), CMYK
(Cyan-Magenta-Yellow-Black ink color separation), and color palette
TIFF files. An RGB file can have either single plane (interleaved)
color or multiple plane format. The program reads 1-8 and 16
bit-per-sample input, the latter in either bigendian or littlendian
encoding. Tiff directory information may also be either bigendian or
littendian.
<P>
One reason this program isn't as general as TIFF programs often are is
that it does not use the TIFFRGBAImageGet() function of the TIFF
library to read TIFF files. Rather, it uses the more primitive
TIFFReadScanLine() function and decodes it itself.
<P>
There is no fundamental reason that this program could not read other
kinds of TIFF files; the existing limitations are mainly because no one
has asked for more.
<P>
The PNM output has the same maxval as the Tiff input, except that if
the Tiff input is colormapped (which implies a maxval of 65535) the
PNM output has a maxval of 255. Though this may result in lost
information, such input images hardly ever actually have more color
resolution than a maxval of 255 provides and people often cannot deal
with PNM files that have maxval &gt; 255. By contrast, a non-colormapped
Tiff image that doesn't need a maxval &gt; 255 doesn't
<I>have</I>
a maxval &gt; 255, so when we see a non-colormapped maxval &gt; 255, we take
it seriously and produce a matching output maxval.
<P>
The
<I>tiff-filename</I>
argument names the regular file that contains the Tiff image.
If you specify &quot;-&quot; or don't specify this argument,
<B>tfftopnm</B>
uses Standard Input. In either case, the file must be seekable. That
means no pipe, but any regular file is fine.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>-alphaout=</B><I>alpha-filename</I>
<DD>
<B>tifftopnm </B>
creates a PGM (portable graymap) file containing the alpha channel
values in the input image. If the input image doesn't contain an
alpha channel, the
<I>alpha-filename</I>
file contains all zero (transparent) alpha values. If you don't specify
<B>-alphaout</B>,
<B>tifftopnm</B>
does not generate an alpha file, and if the input image has an alpha channel,
<B>tifftopnm</B>
simply discards it.
<P>
If you specify
<B>-</B>
as the filename,
<B>tifftopnm</B>
writes the alpha output to Standard Output and discards the image.
<P>
See
<B><A HREF="/cgi-bin/man/man2html?1+pnmcomp">pnmcomp</A></B>(1)
for one way to use the alpha output file.
<DT id="2"><B>-respectfillorder</B>
<DD>
By default,
<B>tifftopnm </B>
ignores the &quot;fillorder&quot; tag in the TIFF input, which means
it may incorrectly interpret the image. To make it follow the spec,
use this option. For a lengthy but engaging discussion of why
<B>tifftopnm</B>
works this way and how to use the
<B>-respectfillorder</B>
option, see the note on fillorder below.
<P>
<DT id="3"><B>-headerdump</B>
<DD>
Dump TIFF file information to stderr. This information may be useful
in debugging TIFF file conversion problems.
</DL>
<P>
All options can be abbreviated to their shortest unique prefix.
<P>
<A NAME="lbAF">&nbsp;</A>
<H2>NOTES</H2>
<A NAME="lbAG">&nbsp;</A>
<H3>Fillorder</H3>
<P>
There is a piece of information in the header of a TIFF image called
&quot;fillorder.&quot; The TIFF specification quite clearly states that this value
tells the order in which bits are arranged in a byte in the description
of the image's pixels. There are two options, assuming that the image has
a format where more than one pixel can be represented by a single byte:
1) the byte is filled from most signficant bit to least signficant bit
going left to right in the image; and 2) the opposite.
<P>
However, there is confusion in the world as to the meaning of
fillorder. Evidence shows that some people believe it has to do with
byte order when a single value is represented by two bytes.
<P>
These people cause TIFF images to be created that, while they use a
MSB-to-LSB fillorder, have a fillorder tag that says they used LSB-to-MSB.
A program that properly interprets a TIFF image will not end up with the
image that the author intended in this case.
<P>
For a long time,
<B>tifftopnm</B>
did not understand fillorder itself and assumed the fillorder was
MSB-to-LSB regardless of the fillorder tag in the TIFF header. And as
far as I know, there is no legitimate reason to use a fillorder other
than MSB-to-LSB. So users of
<B>tifftopnm</B>
were happily using those TIFF images that had incorrect fillorder tags.
<P>
So that those users can continue to be happy,
<B>tifftopnm</B>
today continues to ignore the fillorder tag unless you tell it not to.
(It does, however, warn you when the fillorder tag does not say
MSB-to-LSB that the tag is being ignored).
<P>
If for some reason you have a TIFF image that actually has LSB-to-MSB
fillorder, and its fillorder tag correctly indicates that, you must use
the
<B>-respectfillorder</B>
option on
<B>tifftopnm</B>
to get proper results.
<P>
Examples of incorrect TIFF images are at <A HREF="ftp://weather.noaa.gov.">ftp://weather.noaa.gov.</A> They
are apparently created by a program called
<B>faxtotiff</B>.
<P>
This note was written on January 1, 2002.
<P>
<P>
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+pnmtotiff">pnmtotiff</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+pnmtotiffcmyk">pnmtotiffcmyk</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+pnmcomp">pnmcomp</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?5+pnm">pnm</A></B>(5)
<A NAME="lbAI">&nbsp;</A>
<H2>AUTHOR</H2>
Derived by Jef Poskanzer from tif2ras.c, which is
Copyright (c) 1990 by Sun Microsystems, Inc.
Author: Patrick J. Naughton (<A HREF="mailto:naughton@wind.sun.com">naughton@wind.sun.com</A>).
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="7"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="8"><A HREF="#lbAF">NOTES</A><DD>
<DL>
<DT id="9"><A HREF="#lbAG">Fillorder</A><DD>
</DL>
<DT id="10"><A HREF="#lbAH">SEE ALSO</A><DD>
<DT id="11"><A HREF="#lbAI">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:28 GMT, March 31, 2021
</BODY>
</HTML>