1Tifftopnm User Manual(0)                              Tifftopnm User Manual(0)
2
3
4

NAME

6       tifftopnm - convert a TIFF file into a PNM image
7
8

SYNOPSIS

10       tifftopnm
11
12       [-alphaout={alpha-filename,-}]  [-headerdump]  [-verbose] [-respectfil‐
13       lorder] [-byrow] [-orientraw] [tiff-filename]
14
15
16

DESCRIPTION

18       This program is part of Netpbm(1).
19
20       tifftopnm reads a TIFF file as input and produces a PNM image  as  out‐
21       put.   The  type of the output file depends on the input file - if it's
22       black & white, generates a PBM image; if it's  grayscale,  generates  a
23       PGM image; otherwise, a PPM image.  The program tells you which type it
24       is writing.
25
26       If the TIFF file contains multiple  images  (multiple  'directories,'),
27       tifftopnm  generates  a  multi-image  PNM output stream.  Before Netpbm
28       10.27 (March 2005), however, it would just ignore  all  but  the  first
29       input image.
30
31       The  tiff-filename  argument  names  the regular file that contains the
32       Tiff image.  If  you  specify  '-'  or  don't  specify  this  argument,
33       tfftopnm  uses  Standard  Input. In either case, the file must be seek‐
34       able.  That means no pipe, but any regular file is fine.
35
36
37   TIFF Capability
38       pamtotiff uses the Libtiff.org TIFF library (or whatever equivalent you
39       provide)  to  interpret the TIFF input.  So the set of files it is able
40       to interpret is determined mostly by that library.
41
42       This program cannot read every possible TIFF file -- there  are  myriad
43       variations  of the TIFF format.  However, it does understand monochrome
44       and gray scale, RGB, RGBA (red/green/blue  with  alpha  channel),  CMYK
45       (Cyan-Magenta-Yellow-Black  ink  color  separation),  and color palette
46       TIFF files.  An RGB file can have  either  single  plane  (interleaved)
47       color  or multiple plane format.  The program reads 1-8 and 16 bit-per-
48       sample input, the latter in either bigendian or  littlendian  encoding.
49       Tiff directory information may also be either bigendian or littlendian.
50
51       There  are  many TIFF formats that tifftopnm can read only if the image
52       is small enough to fit in memory.  tifftopnm uses  the  TIFF  library's
53       TIFFRGBAImageGet()  function  to  process  the TIFF image if it can get
54       enough memory for TIFFRGBAImageGet() to store the whole image in memory
55       at  once (that's what TIFFRGBAImageGet() does).  If not, tifftopnm uses
56       a more primitive row-by-row conversion  strategy  using  the  raw  data
57       returned  by  TIFFReadScanLine()  and native intelligence.  That native
58       intelligence does not know as many formats as TIFFRGBAImageGet()  does.
59       And certain compressed formats simply cannot be read with TIFFReadScan‐
60       Line().
61
62       Before Netpbm 10.11 (October 2002), tifftopnm  never  used  TIFFRGBAIm‐
63       ageGet(),  so  it could not interpret many of the formats it can inter‐
64       pret today.
65
66       There is no fundamental reason that this program could not  read  other
67       kinds  of  TIFF  files  even when they don't fit in memory all at once.
68       The existing limitations are mainly because no one has asked for more.
69
70
71   Output Image
72       The PNM output has the same maxval as the Tiff input,  except  that  if
73       the Tiff input is colormapped (which implies a maxval of 65535) the PNM
74       output has a maxval of 255.  Though this may result  in  lost  informa‐
75       tion, such input images hardly ever actually have more color resolution
76       than a maxval of 255 provides and people often  cannot  deal  with  PNM
77       files  that  have  maxval  >  255.  By contrast, a non-colormapped Tiff
78       image that doesn't need a maxval > 255 doesn't have a maxval > 255,  so
79       when  tifftopnm  sees a non-colormapped maxval > 255, it takes it seri‐
80       ously and produces a matching output maxval.
81
82       Another exception is where the TIFF maxval is greater than 65535, which
83       is  the maximum allowed by the Netpbm formats.  In that case, tifftopnm
84       uses a maxval of 65535, and you lose some information  in  the  conver‐
85       sion.
86
87

OPTIONS

89       You  may  abbreviate any option to its shortest unique prefix.  You may
90       use two hyphens instead of one in options.  You may separate an  option
91       and its value either by an equals sign or white space.
92
93
94
95       -alphaout=alpha-filename
96              tifftopnm creates a PGM file containing the alpha channel values
97              in the input image.  If the input image doesn't contain an alpha
98              channel, the alpha-filename file contains all zero (transparent)
99              alpha values.  If you don't specify -alphaout,
100
101              tifftopnm does not generate an alpha  file,  and  if  the  input
102              image has an alpha channel, tifftopnm simply discards it.
103
104              If  you  specify  -  as the filename, tifftopnm writes the alpha
105              output to Standard Output and discards the image.
106
107              See pamcomp(1)foronewaytouse the alpha output file.
108
109
110       -respectfillorder
111              By default, tifftopnm  ignores the 'fillorder' tag in  the  TIFF
112              input,  which  means it may incorrectly interpret the image.  To
113              make it follow the spec, use this option.   For  a  lengthy  but
114              engaging  discussion  of why tifftopnm works this way and how to
115              use the -respectfillorder option,  see  the  note  on  fillorder
116              below.
117
118
119       -byrow This option can make tifftopnm run faster.
120
121              tifftopnm  has two different ways to do the conversion from Tiff
122              to PNM, using two different facilities of the TIFF library:
123
124
125
126
127       Whole Image
128              Decode the entire image into memory at once,  using  TIFFRGBAIm‐
129              ageGet(), then convert to PNM and output row by row.
130
131
132       Row By Row
133              Read,  convert, and output one row at a time using TIFFReadScan‐
134              line().
135
136
137
138              Whole Image is preferable because the Tiff library does more  of
139              the  work,  which  means  it understands more of the Tiff format
140              possibilities now and in the future.  Also, some compressed TIFF
141              formats don't allow you to extract an individual row.
142
143              Row  By Row uses far less memory, which means with large images,
144              it can run in environments where Whole Image cannot and may also
145              run faster.  And because Netpbm code does more of the work, it's
146              possible that it can be more flexible or at  least  give  better
147              diagnostic information if there's something wrong with the TIFF.
148
149              The  Netpbm native code may do something correctly that the TIFF
150              library does incorrectly, or vice versa.
151
152              In Netpbm, we stress function over performance, so by default we
153              try Whole Image first, and if we can't get enough memory for the
154              decoded image or TIFFRGBAImageGet() fails, we fall back  to  Row
155              By  Row.   But  if you specify the -byrow option, tifftopnm will
156              not attempt Whole Image.  If Row By Row does not work, it simply
157              fails.
158
159              See  Color Separation (CMYK) TIFFs ⟨#cmyk⟩  for a description of
160              one way Row By  Row  makes  a  significant  difference  in  your
161              results.
162
163              Whole  Image  costs you precision when your TIFF image uses more
164              than 8 bits per sample.  TIFFRGBAImageGet() converts the samples
165              to 8 bits.  tifftopnm then scales them back to maxval 65535, but
166              the lower 8 bits of information is gone.
167
168              In many versions of the TIFF  library,  TIFFRGBAImageGet()  does
169              not  correctly interpret TIFF files in which the raster orienta‐
170              tion is column-major (i.e. a row of the raster is  a  column  of
171              the  image).   With  such  a TIFF library and file, you must use
172              -byrow to get correct output.
173
174              Before Netpbm 10.11 (October 2002), tifftopnm always did Row  By
175              Row.   Netpbm 10.12 always tried Whole Image first.  -byrow came
176              in with Netpbm 10.13 (January 2003).
177
178
179       -orientraw
180              A TIFF stream contains raster data which can be arranged in  the
181              stream  various  ways.   Most  commonly, it is arranged by rows,
182              with the top row first, and the pixels left to right within each
183              row, but many other orientations are possible.
184
185              The common orientation is the same on the Netpbm formats use, so
186              tifftopnm can do its jobs quite efficiently when the TIFF raster
187              is oriented that way.
188
189              But  if the TIFF raster is oriented any other way, it can take a
190              considerable amount of processing for tifftopnm to convert it to
191              Netpbm format.
192
193              -orientraw  says  to produce an output image that represents the
194              raw raster in the TIFF stream rather than  the  image  the  TIFF
195              stream  is  supposed  to represent.  In the output, the top left
196              corner corresponds to the start of the  TIFF  raster,  the  next
197              pixel  to  the  right is the next pixel in the TIFF raster, etc.
198              tifftopnm can do this easily, but you don't get the right  image
199              out.   You can use pamflip to turn the output into the image the
200              TIFF stream represents (but if you do that, you pretty much lose
201              the benefit of -orientraw).
202
203              With  this  option,  tifftopnm always uses the Row By Row method
204              (see -byrow).
205
206              This option was new in Netpbm 10.42 (March 2008).  Before  that,
207              tifftopnm  generally produces arbitrary results with TIFF images
208              that have an orientation other than the common one.
209
210
211       -verbose
212              Print extra messages to Standard Error about the conversion.
213
214
215       -headerdump
216              Dump TIFF file information to stderr.  This information  may  be
217              useful in debugging TIFF file conversion problems.
218
219
220
221

NOTES

223   Fillorder
224       There  is  a  piece of information in the header of a TIFF image called
225       'fillorder.' The TIFF specification  quite  clearly  states  that  this
226       value  tells  the  order  in  which  bits are arranged in a byte in the
227       description of the image's pixels.  There  are  two  options,  assuming
228       that  the  image  has  a format where more than one pixel can be repre‐
229       sented by a single byte: 1) the byte is filled  from  most  significant
230       bit  to  least significant bit going left to right in the image; and 2)
231       the opposite.
232
233       However, there is confusion in the world as  to  the  meaning  of  fil‐
234       lorder.  Evidence shows that some people believe it has to do with byte
235       order when a single value is represented by two bytes.
236
237       These people cause TIFF images to be created that,  while  they  use  a
238       MSB-to-LSB  fillorder, have a fillorder tag that says they used LSB-to-
239       MSB.  A program that properly interprets a TIFF image will not  end  up
240       with the image that the author intended in this case.
241
242       For  a  long  time,  tifftopnm  did not understand fillorder itself and
243       assumed the fillorder was MSB-to-LSB regardless of the fillorder tag in
244       the  TIFF  header.  And as far as I know, there is no legitimate reason
245       to use a fillorder other than MSB-to-LSB.  So users of  tifftopnm  were
246       happily using those TIFF images that had incorrect fillorder tags.
247
248       So that those users can continue to be happy, tifftopnm today continues
249       to ignore the fillorder tag unless you tell it not to.  (It does,  how‐
250       ever,  warn you when the fillorder tag does not say MSB-to-LSB that the
251       tag is being ignored).
252
253       If for some reason you have a TIFF image that actually  has  LSB-to-MSB
254       fillorder, and its fillorder tag correctly indicates that, you must use
255       the -respectfillorder option on tifftopnm to get proper results.
256
257       Examples  of  incorrect  TIFF  images  are  at  ftp://weather.noaa.gov.
258       ⟨ftp://weather.noaa.gov.⟩    They  are  apparently created by a program
259       called faxtotiff.
260
261       This note was written on January 1, 2002.
262
263
264
265   Color Separation (CMYK) TIFFs
266       Some TIFF images contain color information in CMYK  form,  whereas  PNM
267       images  use  RGB.   There  are  various formulas for converting between
268       these two forms, and tifftopnm can use either of two.
269
270       The TIFF library (Version 3.5.4 from  libtiff.org)  uses  Y=(1-K)*(1-B)
271       (similar  for  R  and  G)  in  its  TIFFRGBAImageGet()  service.   When
272       tifftopnm works in Whole Image mode, it uses that  service,  so  that's
273       the conversion you get.
274
275       But when tifftopnm runs in Row By Row mode, it does not use TIFFRGBAIm‐
276       ageGet(), and you get what appears to be more useful: Y=1-(B+K).   This
277       is the inverse of what pnmtotiffcmyk does.
278
279       See the -byrow option for more information on Whole Image versus Row By
280       Row mode.
281
282       Before Netpbm 10.21 (March 2004), tifftopnm used the Y=(1-K)*(1-B) for‐
283       mula always.
284
285
286

SEE ALSO

288       pnmtotiff(1), pnmtotiffcmyk(1), pamcomp(1), pnm(1)
289
290

AUTHOR

292       Derived by Jef Poskanzer from tif2ras.c, which is Copyright (c) 1990 by
293       Sun    Microsystems,    Inc.     Author:    Patrick     J.     Naughton
294       (naughton@wind.sun.com).
295
296
297
298netpbm documentation             12 July 2009         Tifftopnm User Manual(0)
Impressum