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

NAME

6       pamtotiff - convert a Netpbm image to a TIFF file
7
8

SYNOPSIS

10       pamtotiff
11
12       [-none | -packbits | -lzw | -g3 | -g4 | -flate | -adobeflate]
13
14       [-2d]
15
16       [-fill]
17
18       [-predictor=n]
19
20       [-msb2lsb|-lsb2msb]
21
22       [-rowsperstrip=n]
23
24       [-minisblack|-miniswhite|mb|mw]
25
26       [-truecolor]
27
28       [-color]
29
30       [-indexbits=bitwidthlist] [-xresolution=xres]
31
32       [-yresolution=yres]  [-resolutionunit={inch  | centimeter | none | in |
33       cm | no}]
34
35       [-append]
36
37       [-tag=taglist]
38
39       [pamfile]
40
41       You can use the minimum unique abbreviation of the  options.   You  can
42       use  two  hyphens instead of one.  You can separate an option name from
43       its value with white space instead of an equals sign.
44
45

DESCRIPTION

47       This program is part of Netpbm(1).
48
49       pamtotiff reads a PNM or PAM image as input and produces a TIFF file as
50       output.
51
52       Actually,  it handles multi-image Netpbm streams, producing multi-image
53       TIFF streams (i.e. a TIFF stream  with  multiple  "directories").   But
54       before  Netpbm  10.27 (March 2005), it ignored all but the first Netpbm
55       image in the input stream.
56
57
58   The Output File
59       By default, the output goes to Standard Output.  Alternatively, you can
60       specify an output file with the -output option and pamtotiff will write
61       its output directly to that file.
62
63       Because of the way the TIFF library (which pamtotiff uses) works,  when
64       the  program  writes  to  Standard Output, it generates the entire TIFF
65       image in a temporary file and then copies it to  Standard  Output;  you
66       may see negative performance effects of this.
67
68       The  -output  method avoids the performance effects of the copy through
69       the temporary file, but there are restrictions on the output  file:  it
70       must  be  seekable and it must be readable.  The program fails if it is
71       not.  With Standard Output, neither of those restrictions applies.
72
73       With -output, if the file already exists and has data in it,  pamtotiff
74       appends  the image to the existing TIFF file.  (A TIFF file may contain
75       multiple images).
76
77       By default, pamtotiff creates the file named by -output if it does  not
78       already  exist.   But if you also specify -append, the program fails if
79       the file named by -output does not already exist.
80
81       Before Netpbm 10.67 (June 2014), there is no -output option  and  Stan‐
82       dard Output must be seekable.  So pipes are out.
83
84       Before  Netpbm  10.67 (June 2014), you could append to Standard Output.
85       See below.  The current program does not have the ability; you must use
86       -output to append to an existing TIFF file.
87
88       The  difference  above means current pamtotiff is actually not backward
89       compatible, which is a rare thing for Netpbm.  But it's  a  good  thing
90       because the previous function was very strange and probably hardly ever
91       exploited.
92
93
94       Old Versions
95
96       As alluded to above, pamtotiff does output very differently in releases
97       before  10.67.   The  following  describes  the  old function, which is
98       unusual both for Netpbm and for Unix programs in general.
99
100
101
102       ·      The output file must be seekable.  pamtotiff does not  write  it
103              sequentially.   Therefore,  you can't use a pipe; you can't pipe
104              the output of pamtotiff to some other program.  But any  regular
105              file should work.
106
107
108       ·      If the output file descriptor is readable, you must either spec‐
109              ify -append so as to add to the existing file, or make sure  the
110              file is empty.  Otherwise, pamtotiff will fail with an unhelpful
111              message telling you that a TIFF library function failed to  open
112              the TIFF output stream.
113
114
115       ·      If  you  are  converting multiple images (your input stream con‐
116              tains multiple images), the output file must  be  both  readable
117              and writable.
118
119
120
121       If  you're using a Unix command shell to run pamtotiff, you use facili‐
122       ties of your shell to set up Standard Output.  In  Bash,  for  example,
123       you  would  set  up a write-only Standard Output to the file /tmp/myim‐
124       age.tiff like this:
125
126           $ pamtotiff myimage.pnm >/tmp/myimage.tiff
127
128       In Bash, you would set up a read/write  Standard  Output  to  the  file
129       /tmp/myimage.tiff like this:
130
131           $ pamtotiff myimage.pnm 1<>/tmp/myimage.tiff
132
133
134   TIFF Capability
135       pamtotiff uses the Libtiff.org TIFF library (or whatever equivalent you
136       provide) to generate the TIFF output.  Details of the  format  it  pro‐
137       duces are therefore controlled by that library.
138
139

OPTIONS

141       In  addition  to  the options common to all programs based on libnetpbm
142       (most notably -quiet, see
143        Common Options ⟨index.html#commonoptions⟩ ), pamtotiff recognizes  the
144       following command line options:
145
146
147   Compression
148       By default, pamtotiff creates a TIFF file with no compression.  This is
149       your best bet most of the time.  If you want to try another compression
150       scheme  or  tweak  some  of the other even more obscure output options,
151       there are a number of options which to play.
152
153       Before Netpbm 8.4 (April 2000), the default was to use LZW compression.
154       But then new releases of the TIFF library started omitting the LZW com‐
155       pression capability because of concern about patents on LZW.  So  since
156       then,  the  default  has been no compression.  The LZW patents have now
157       expired and new TIFF libraries  do  LZW,  but  the  pamtotiff  behavior
158       remains the same for compatibility with older TIFF libraries and appli‐
159       cations of pamtotiff.
160
161       The -none, -packbits, -lzw, -g3, -g4, -flate, and  -adobeflate  options
162       are used to override the default and set the compression scheme used in
163       creating the output file.
164
165       The -predictor option is meaningful only with LZW compression:  a  pre‐
166       dictor  value  of 2 causes each scanline of the output image to undergo
167       horizontal differencing before it is encoded; a value of 1 forces  each
168       scanline  to  be  encoded  without differencing.  By default, pamtotiff
169       creates a TIFF file with  msb-to-lsb  fill  order.   The  -msb2lsb  and
170       -lsb2msb  options  are  used  to  override the default and set the fill
171       order used in creating the file.
172
173       With some older TIFF libraries, -lzw  doesn't  work  because  the  TIFF
174       library  doesn't do LZW compression.  This is because of concerns about
175       Unisys's patent on LZW which was then in force.   Actually,  with  very
176       old  TIFF  libraries,  -lzw  works  because no distributors of the TIFF
177       library were sensitive yet to the patent issue.
178
179       -flate chooses "flate" compression, which is the  patent-free  compres‐
180       sion  common  in  the Unix world implemented by the "Z" library.  It is
181       what the PNG format uses.
182
183       Fax Compression
184
185       If you have bilevel data (e.g. PBM), you can generate a TIFF that  uses
186       the same compression scheme specified for use by fax machines.  See the
187       Fax Format(1) page for more information on these compression schemes.
188
189       These formats all relate to ITU Group 3 and Group 4 fax  machine  stan‐
190       dards.
191
192       The  -g3  option  chooses  MH or MR compression: MR with the additional
193       option -2d; MH without it.  -g4 selects MMR.  The option  names  are  a
194       little  unfortunate  and  historical,  but are consistent with the TIFF
195       specification.
196
197       MMR has a better compression ratio than the other two.
198
199       -fill specifies that for MH or MR compression,  each  encoded  scanline
200       shall be zero-filled to a byte boundary.
201
202       -2d and -fill are meaningful only with -g3.
203
204
205
206   Fill Order
207       The -msb2lsb and lsb2msb options control the fill order.
208
209       The  fill  order is the order in which pixels are packed into a byte in
210       the Tiff raster, in the case that there are multiple pixels  per  byte.
211       msb-to-lsb means that the leftmost columns go into the most significant
212       bits of the byte in the Tiff image.   However,  there  is  considerable
213       confusion  about  the  meaning  of  fill  order.  Some believe it means
214       whether 16 bit sample values in the Tiff  image  are  little-endian  or
215       big-endian.  This is totally erroneous (The endianness of integers in a
216       Tiff image is  designated  by  the  image's  magic  number).   However,
217       ImageMagick  and  older  Netpbm  both have been known to implement that
218       interpretation.  2001.09.06.
219
220       If the image does not have  sub-byte  pixels,  these  options  have  no
221       effect  other  than  to  set the value of the FILLORDER tag in the Tiff
222       image (which may be useful for those programs that misinterpret the tag
223       with reference to 16 bit samples).
224
225
226   Color Space
227       -color  tells  pamtotiff  to  produce a color, as opposed to grayscale,
228       TIFF image if the input is PPM, even if  it  contains  only  shades  of
229       gray.   Without  this option, pamtotiff produces a grayscale TIFF image
230       if the input is PPM and contains only shades of gray, and at  most  256
231       shades.   Otherwise,  it produces a color TIFF output.  For PBM and PGM
232       input, pamtotiff always produces grayscale TIFF output and this  option
233       has no effect.
234
235       The  -color option can prevent pamtotiff from making two passes through
236       the input file, thus improving speed and memory  usage.   See  Multiple
237       Passes ⟨#multipass⟩ .
238
239       -truecolor  tells pamtotiff to produce the 24-bit RGB form of TIFF out‐
240       put if it is producing a color TIFF image.  Without this option, pamto‐
241       tiff produces a colormapped (paletted) TIFF image unless there are more
242       than 256 colors (and in the latter case, issues a warning).
243
244       The -truecolor option can prevent  pamtotiff  from  making  two  passes
245       through  the  input  file,  thus improving speed and memory usage.  See
246       Multiple Passes ⟨#multipass⟩ .
247
248       The -color and -truecolor options did  not  exist  before  Netpbm  9.21
249       (December 2001).
250
251       If  pamtotiff  produces  a  grayscale  TIFF  image,  this option has no
252       effect.
253
254       The -minisblack and -miniswhite options force the output image to  have
255       a  "minimum  is black" or "minimum is white" photometric, respectively.
256       If you don't specify either, pamtotiff uses  minimum  is  black  except
257       when using Group 3 or Group 4 compression, in which case pamtotiff fol‐
258       lows CCITT fax standards and uses  "minimum  is  white."  This  usually
259       results  in  better  compression and is generally preferred for bilevel
260       coding.  These photometrics are for grayscale images, so these  options
261       are  invalid if the image is color (but only if it is truly color; they
262       are valid with, for example, a PPM image that contains only  shades  of
263       gray).
264
265       Before  Netpbm 9.11 (February 200)1, pamtotiff always produced "minimum
266       is black," because of a bug.  In either case, pamtotiff sets the photo‐
267       metric  interpretation tag in the TIFF output according to which photo‐
268       metric is actually used.
269
270       Before Netpbm 10.78 (March 2017), pamtotiff respected  -miniswhite  and
271       -minisblack  even with color images, producing invalid TIFF images that
272       have the indicated photometric but red, green, and blue raster planes.
273
274       The -indexbits option is meaningful only for a  colormapped  (paletted)
275       image.   In  this  kind  of image, the raster contains values which are
276       indexes into a table of colors, with the indexes normally  taking  less
277       space  that the color description in the table.  pamtotiff can generate
278       indexes of 1, 2, 4, or 8 bits.  By default, it will use 8, because many
279       programs that interpret TIFF images can't handle any other width.
280
281       But  if you have a small number of colors, you can make your image con‐
282       siderably smaller by allowing fewer than 8 bits per  index,  using  the
283       -indexbits  option.   The  value  is  a comma-separated list of the bit
284       widths you allow.  pamtotiff chooses the smallest width you allow  that
285       allows it to index the entire color table.  If you don't allow any such
286       width, pamtotiff fails.  Normally,  the  only  useful  value  for  this
287       option is 1,2,4,8, because a program either understands the 8 bit width
288       (default) or understands them all.
289
290       In a Baseline TIFF image, according to the 1992 TIFF 6.0 specification,
291       4  and 8 are the only valid widths.  There are no formal standards that
292       allow any other values.
293
294       This option was added in June 2002.  Before that, only  8  bit  indices
295       were possible.
296
297
298   Extra Tags
299       There are lots of tag types in the TIFF format that don't correspond to
300       any information in the PNM format or  to  anything  in  the  conversion
301       process.   For  example, a TIFF_ARTIST tag names the artist who created
302       the image.
303
304       You can tell pamtotiff explicitly to include tags such as this  in  its
305       output with the -tag option.  You identify a list of tag types and val‐
306       ues and pamtotiff includes a tag in the output for each  item  in  your
307       list.
308
309       The value of -tag is the list of tags, like this example:
310
311           -tag=subfiletype=reducedimage,documentname=Fred,xposition=25
312
313       As  you  see,  it  is a list of tag specifications separated by commas.
314       Each tag specification is a name and a  value  separated  by  an  equal
315       sign.   The  name  is  the  name  of  the tag type, except in arbitrary
316       upper/lower case.  One place to see the names of TIFF tag types  is  in
317       the TIFF library's tiff.h file, where there is a macro defined for each
318       consisting of "TIFF_" plus the name.   E.g.  for  the  SUBFILETYPE  tag
319       type, there is a macro TIFF_SUBFILETYPE.
320
321       The  format of the value specification for a tag (stuff after the equal
322       sign) depends upon what kind of value the tag type has:
323
324
325
326       ·      Integer: a decimal number
327
328
329       ·      Floating point number: a decimal number
330
331
332       ·      String: a string
333
334
335       ·      Enumerated (For example, a 'subfiletype' tag takes an enumerated
336              value.   Its possible values are REDUCEDIMAGE, PAGE, and MASK.):
337              The name of the value.  You can see the possible value names  in
338              the  TIFF  library's tiff.h file, where there is a macro defined
339              for each consisting of a qualifier plus the  value  name.   E.g.
340              for  the  REDUCEDIMAGE  value  of a SUBFILETYPE tag, you see the
341              macro FILETYPE_REDUCEDIMAGE.
342
343              The TIFF format assigns a unique number to each enumerated value
344              and  you can specify that number, in decimal, as an alternative.
345              This is useful if you are using an extension of TIFF that pamto‐
346              tiff doesn't know about.
347
348
349
350       If you specify a tag type with -tag that is not independent of the con‐
351       tent of your PNM source image and pamtotiff's conversion process  (i.e.
352       a  tag  type  in  which pamtotiff is interested), pamtotiff fails.  For
353       example, you cannot specify an IMAGEWIDTH tag with -tag, because pamto‐
354       tiff  generates  an  IMAGEWIDTH  tag that gives the actual width of the
355       image.
356
357       -tag was new in Netpbm 10.31 (December 2005).
358
359
360   Output
361       See The Output File ⟨#output⟩ .
362
363       -output names the output file.  Without this option pamtotiff writes to
364       Standard Output.
365
366       The  -append option tells pamtotiff only to append to the file named by
367       output; not create it.  Without this option, the  program  creates  the
368       file  it  does  not  already  exist.   But  even then, if the file does
369       already exist, the program appends the image to what  is  in  the  file
370       already.  (A TIFF file may contain multiple images).
371
372       -append has no effect if you don't also specify -output.
373
374       Before Netpbm 10.67 (June 2014), -append means something rather differ‐
375       ent: it means to append the image to the output  TIFF  file  (which  is
376       always Standard Output in 10.67) instead of replacing its contents.
377
378       -append was new in Netpbm 10.27 (March 2005).
379
380
381
382
383   Other
384       You  can  use the -rowsperstrip option to set the number of rows (scan‐
385       lines) in each strip of data in the output file.  By default, the  out‐
386       put  file  has  the  number  of rows per strip set to a value that will
387       ensure each strip is no more than 8 kilobytes long.
388
389
390

NOTES

392       There are myriad variations of the TIFF format, and this program gener‐
393       ates  only  a  few of them.  pamtotiff creates a grayscale TIFF file if
394       its input is a PBM (monochrome) or PGM (grayscale)  or  equivalent  PAM
395       file.   pamtotiff  also  creates  a  grayscale  file if it input is PPM
396       (color) or equivalent PAM, but there is only one color in the image.
397
398       If the input is a PPM (color) file and there are 256 colors  or  fewer,
399       but  more  than  1,  pamtotiff generates a color palette TIFF file.  If
400       there are more colors than that, pamtotiff generates an RGB (not  RGBA)
401       single  plane  TIFF  file.   Use  pnmtotiffcmyk  to  generate the cyan-
402       magenta-yellow-black ink color separation TIFF format.
403
404       The number of bits per sample in the TIFF output is determined  by  the
405       maxval  of  the Netpbm input.  If the maxval is less than 256, the bits
406       per sample in the output is the smallest number  that  can  encode  the
407       maxval.   If  the  maxval is greater than or equal to 256, there are 16
408       bits per sample in the output.
409
410
411   Extra Channels
412       Like most Netpbm programs, pamtotiff's function is mostly undefined  if
413       the  input  is  PAM  image  with  tuple  type other than BLACKANDWHITE,
414       GRAYSCALE, or RGB.  Most of the statements in this  manual  assume  the
415       input  is  not  such an exotic PAM.  But there is a little defined pro‐
416       cessing of other PAM subformats.
417
418       pamtotiff assumes any 1 plane PAM image is BLACKANDWHITE  or  GRAYSCALE
419       (and doesn't distinguish between those two).
420
421       pamtotiff  assumes  a  PAM  with more than 1 plane is of tuple type RGB
422       except with that number of planes  instead  of  3.   pamtotiff  doesn't
423       really  understand  red,  green,  and blue, so it has no trouble with a
424       2-component or 5-component color space.   The  TIFF  format  allows  an
425       arbitrary  number of color components, so pamtotiff simply maps the PAM
426       planes directly to TIFF color components.  I don't know if the meanings
427       of  5  components in a TIFF image are standard at all, but the function
428       is there if you want to use it.
429
430       Note that pamtotiff may generate  either  a  truecolor  or  colormapped
431       image  with  an arbitrary number of color components.  In the truecolor
432       case, the raster has that number of planes.  In the  colormapped  case,
433       the  raster  has of course 1 plane, but the color map has all the color
434       components in it.
435
436       The most common reason for a PAM to have extra planes is when the tuple
437       type  is  xxx_ALPHA, which means the highest numbered plane is a trans‐
438       parency plane (alpha channel).  At least one user  found  that  a  TIFF
439       with an extra plane for transparency was useful.
440
441       Note  that  the  grayscale detection works on N-component colors, so if
442       your planes aren't really color components, you'll want to disable this
443       via the -color option.
444
445
446
447   Multiple Passes
448       pamtotiff  reads  the  input image once if it can, and otherwise twice.
449       It needs that second pass (which  happens  before  the  main  pass,  of
450       course)  to  analyze  the  colors in the image and generate a color map
451       (palette) and determine if the image is grayscale.  So the second  pass
452       happens only when the input is PPM.  And you can avoid it then by spec‐
453       ifying both the -truecolor and -color options.
454
455        If the input image is small enough to fit in your system's file cache,
456       the  second  pass  is very fast.  If not, it requires reading from disk
457       twice, which can be slow.
458
459       When the input is from a file that cannot be rewound and reread, pamto‐
460       tiff  reads the entire input image into a temporary file which can, and
461       works from that.  Even if it needs only one pass.
462
463       Before Netpbm 9.21 (December 2001), pamtotiff always  read  the  entire
464       image  into  virtual  memory  and  then  did  one, two, or three passes
465       through the memory copy.  The -truecolor and  -color  options  did  not
466       exist.   The  passes  through  memory  would involve page faults if the
467       entire image did not  fit  into  real  memory.   The  image  in  memory
468       required  considerably more memory (12 bytes per pixel) than the cached
469       file version of the image would.
470
471
472
473   Resolution
474       A Tiff image may contain information about the resolution of the image,
475       which  means  how big in real dimensions (centimeters, etc.) each pixel
476       in the raster is.  That information is in the TIFF XRESOLUTION,  YRESO‐
477       LUTION,  and  RESOLUTIONUNIT  tags.   By  default,  pamtotiff  does not
478       include any tags of these types, but you  can  specify  them  with  the
479       -tags option.
480
481       There are also options -xresolution, -yresolution, and -resolutionunit,
482       but those are obsolete.  Before  -tags  existed  (before  Netpbm  10.31
483       (December 2005), they were the only way.
484
485       Note  that  the  number of pixels in the image and how much information
486       each contains is determined independently from the setting of the reso‐
487       lution  tags.  The number of pixels in the output is the same as in the
488       input, and each pixel contains the same information.  For your  resolu‐
489       tion  tags to be meaningful, they have to consistent with whatever cre‐
490       ated the PNM input.  E.g. if a scanner  turned  a  10  centimeter  wide
491       image into a 1000 pixel wide PNM image, then your horizontal resolution
492       is 100 pixels per centimeter, and if your XRESOLUTION tag says anything
493       else,  something  that prints your TIFF image won't print the proper 10
494       centimeter image.
495
496       The value of the XRESOLUTION tag is a  floating  point  decimal  number
497       that  tells how many pixels there are per unit of distance in the hori‐
498       zontal direction.  -yresolution is analogous for  the  vertical  direc‐
499       tion.
500
501       The  unit  of  distance  is  given  by  the value of the RESOLUTIONUNIT
502       option.  That value is either INCH, CENTIMETER, or  NONE.   NONE  means
503       the unit is arbitrary or unspecified.  This could mean that the creator
504       and user of the image have a separate agreement as to what the unit is.
505       But  usually, it just means that the horizontal and vertical resolution
506       values cannot be used for anything except  to  determine  aspect  ratio
507       (because even though the unit is arbitrary or unspecified, it has to be
508       the same for both resolution numbers).
509
510       If you don't use a -tag option to specify the resolution  tag  and  use
511       the obsolete options instead, note the following:
512
513
514
515       ·      If  you  don't  include  an specify -xresolution, the Tiff image
516              does not contain horizontal  resolution  information.   Likewise
517              for  -yresolution.   If  you  don't specify -resolutionunit, the
518              default is inches.
519
520
521       ·      Before Netpbm 10.16 (June 2003), -resolutionunit did  not  exist
522              and the resolution unit was always inches.
523
524
525
526

HISTORY

528       pamtotiff  was  originally  pnmtotiff and did not handle PAM input.  It
529       was extended and renamed in Netpbm 10.30 (October 2005).
530
531
532

SEE ALSO

534       tifftopnm(1), pnmtotiffcmyk(1), pamdepth(1), pamtopnm(1), pam(1)
535
536

AUTHOR

538       Derived by Jef Poskanzer from ras2tiff.c, which is Copyright  (c)  1990
539       by    Sun    Microsystems,    Inc.    Author:   Patrick   J.   Naughton
540       (naughton@wind.sun.com).
541

DOCUMENT SOURCE

543       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
544       source.  The master documentation is at
545
546              http://netpbm.sourceforge.net/doc/pamtotiff.html
547
548netpbm documentation             05 April 2017        Pamtotiff User Manual(0)
Impressum