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       [-indexbits=[1[2[4[8]]]]]
36
37       [-append]
38
39       [-tag=taglist]
40
41       [pamfile]
42
43       You can use the minimum unique abbreviation of the  options.   You  can
44       use  two  hyphens instead of one.  You can separate an option name from
45       its value with white space instead of an equals sign.
46
47

DESCRIPTION

49       This program is part of Netpbm(1).
50
51       pamtotiff reads a PNM or PAM image as input and produces a TIFF file as
52       output.
53
54       Actually,  it handles multi-image Netpbm streams, producing multi-image
55       TIFF streams (i.e. a TIFF stream  with  multiple  'directories').   But
56       before  Netpbm  10.27 (March 2005), it ignored all but the first Netpbm
57       image in the input stream.
58
59
60   The Output File
61       The output goes to Standard Output.  pamtotiff approaches  this  output
62       file differently from Unix and Netpbm convention.  This is entirely due
63       to pamtotiff's use of the TIFF library to do all TIFF output.
64
65
66
67       ·      The output file must be seekable.  pamtotiff does not  write  it
68              sequentially.   Therefore,  you can't use a pipe; you can't pipe
69              the output of pamtotiff to some other program.  But any  regular
70              file should work.
71
72
73       ·      If the output file descriptor is readable, you must either spec‐
74              ify -append so as to add to the existing file, or make sure  the
75              file is empty.  Otherwise, pamtotiff will fail with an unhelpful
76              message telling you that a TIFF library function failed to  open
77              the TIFF output stream.
78
79
80       ·      If  you  are  converting multiple images (your input stream con‐
81              tains multiple images), the output file must  be  both  readable
82              and writable.
83
84
85
86       If  you're using a Unix command shell to run pamtotiff, you use facili‐
87       ties of your shell to set up Standard Output.  In  Bash,  for  example,
88       you  would  set  up a write-only Standard Output to the file /tmp/myim‐
89       age.tiff like this:
90
91           $ pamtotiff myimage.pnm >/tmp/myimage.tiff
92
93       In Bash, you would set up a read/write  Standard  Output  to  the  file
94       /tmp/myimage.tiff like this:
95
96           $ pamtotiff myimage.pnm 1<>/tmp/myimage.tiff
97
98

OPTIONS

100   Compression
101       By default, pamtotiff creates a TIFF file with no compression.  This is
102       your best bet most of the time.  If you want to try another compression
103       scheme  or  tweak  some  of the other even more obscure output options,
104       there are a number of options which which to play.
105
106       Before Netpbm 8.4 (April 2000), the default was to use LZW compression.
107       But then new releases of the TIFF library started omitting the LZW com‐
108       pression capability due to concern about  patents  on  LZW.   So  since
109       then,  the  default  has been no compression.  The LZW patents have now
110       expired and new TIFF libraries  do  LZW,  but  the  pamtotiff  behavior
111       remains the same for compatibility with older TIFF libraries and appli‐
112       cations of pamtotiff.
113
114       The -none, -packbits, -lzw, -g3, -g4, -flate, and  -adobeflate  options
115       are used to override the default and set the compression scheme used in
116       creating the output file.  The CCITT Group 3 and  Group  4  compression
117       algorithms  can  be  used  only  with  bilevel data.  The -2d and -fill
118       options are meaningful only with  Group  3  compression:  -2d  requests
119       2-dimensional encoding, while -fill requests that each encoded scanline
120       be zero-filled to a byte boundary.  The -predictor option is meaningful
121       only  with LZW compression: a predictor value of 2 causes each scanline
122       of the output image to undergo horizontal  differencing  before  it  is
123       encoded;  a  value of 1 forces each scanline to be encoded without dif‐
124       ferencing.  By default, pamtotiff creates a TIFF file  with  msb-to-lsb
125       fill order.  The -msb2lsb and -lsb2msb options are used to override the
126       default and set the fill order used in creating the file.
127
128       With some older TIFF libraries, -lzw  doesn't  work  because  the  TIFF
129       library  doesn't do LZW compression.  This is because of concerns about
130       Unisys's patent on LZW which was then in force.   Actually,  with  very
131       old  TIFF  libraries,  -lzw  works  because no distributors of the TIFF
132       library were sensitive yet to the patent issue.
133
134       -flate chooses 'flate' compression, which is the  patent-free  compres‐
135       sion  common  in  the Unix world implemented by the 'Z' library.  It is
136       what the PNG format uses.
137
138
139
140   Fill Order
141       The -msb2lsb and lsb2msb options control the fill order.
142
143       The fill order is the order in which pixels are packed into a  byte  in
144       the  Tiff  raster, in the case that there are multiple pixels per byte.
145       msb-to-lsb means that the leftmost columns go into the most significant
146       bits  of  the  byte  in the Tiff image.  However, there is considerable
147       confusion about the meaning of  fill  order.   Some  believe  it  means
148       whether  16  bit  sample  values in the Tiff image are little-endian or
149       big-endian.  This is totally erroneous (The endianness of integers in a
150       Tiff  image  is  designated  by  the  image's  magic number).  However,
151       ImageMagick and older Netpbm both have been  known  to  implement  that
152       interpretation.  2001.09.06.
153
154       If  the  image  does  not  have  sub-byte pixels, these options have no
155       effect other than to set the value of the FILLORDER  tag  in  the  Tiff
156       image (which may be useful for those programs that misinterpret the tag
157       with reference to 16 bit samples).
158
159
160   Color Space
161       -color tells pamtotiff to produce a color,  as  opposed  to  grayscale,
162       TIFF  image  if  the  input  is PPM, even if it contains only shades of
163       gray.  Without this option, pamtotiff produces a grayscale  TIFF  image
164       if  the  input is PPM and contains only shades of gray, and at most 256
165       shades.  Otherwise, it produces a color TIFF output.  For PBM  and  PGM
166       input,  pamtotiff always produces grayscale TIFF output and this option
167       has no effect.
168
169       The -color option can prevent pamtotiff from making two passes  through
170       the  input  file,  thus improving speed and memory usage.  See Multiple
171       Passes ⟨#multipass⟩ .
172
173       -truecolor tells pamtotiff to produce the 24-bit RGB form of TIFF  out‐
174       put if it is producing a color TIFF image.  Without this option, pamto‐
175       tiff produces a colormapped (paletted) TIFF image unless there are more
176       than 256 colors (and in the latter case, issues a warning).
177
178       The  -truecolor  option  can  prevent  pamtotiff from making two passes
179       through the input file, thus improving speed  and  memory  usage.   See
180       Multiple Passes ⟨#multipass⟩ .
181
182       The  -color  and  -truecolor  options  did not exist before Netpbm 9.21
183       (December 2001).
184
185       If pamtotiff produces a  grayscale  TIFF  image,  this  option  has  no
186       effect.
187
188       The  -minisblack and -miniswhite options force the output image to have
189       a 'minimum is black' or 'minimum is white'  photometric,  respectively.
190       If  you  don't  specify  either, pamtotiff uses minimum is black except
191       when using Group 3 or Group 4 compression, in which case pamtotiff fol‐
192       lows  CCITT  fax  standards  and  uses 'minimum is white.' This usually
193       results in better compression and is generally  preferred  for  bilevel
194       coding.
195
196       Before February 2001, pamtotiff always produced 'minimum is black,' due
197       to a bug.  In either case, pamtotiff sets the  photometric  interpreta‐
198       tion  tag in the TIFF output according to which photometric is actually
199       used.
200
201       The -indexbits option is meaningful only for a  colormapped  (paletted)
202       image.   In  this  kind  of image, the raster contains values which are
203       indexes into a table of colors, with the indexes normally  taking  less
204       space  that the color description in the table.  pamtotiff can generate
205       indexes of 1, 2, 4, or 8 bits.  By default, it will use 8, because many
206       programs that interpret TIFF images can't handle any other width.
207
208       But  if you have a small number of colors, you can make your image con‐
209       siderably smaller by allowing fewer than 8 bits per  index,  using  the
210       -indexbits  option.   The  value  is  a comma-separated list of the bit
211       widths you allow.  pamtotiff chooses the smallest width you allow  that
212       allows it to index the entire color table.  If you don't allow any such
213       width, pamtotiff fails.  Normally,  the  only  useful  value  for  this
214       option is 1,2,4,8, because a program either understands the 8 bit width
215       (default) or understands them all.
216
217       In a Baseline TIFF image, according to the 1992 TIFF 6.0 specification,
218       4  and 8 are the only valid widths.  There are no formal standards that
219       allow any other values.
220
221       This option was added in June 2002.  Before that, only  8  bit  indices
222       were possible.
223
224
225   Extra Tags
226       There are lots of tag types in the TIFF format that don't correspond to
227       any information in the PNM format or  to  anything  in  the  conversion
228       process.   For  example, a TIFF_ARTIST tag names the artist who created
229       the image.
230
231       You can tell pamtotiff explicitly to include tags such as this  in  its
232       output with the -tag option.  You identify a list of tag types and val‐
233       ues and pamtotiff includes a tag in the output for each  item  in  your
234       list.
235
236       The value of -tag is the list of tags, like this example:
237
238       <code>
239           -tag=subfiletype=reducedimage,documentname=Fred,xposition=25
240       </code>
241
242       As  you  see,  it  is a list of tag specifications separated by commas.
243       Each tag specification is a name and a  value  separated  by  an  equal
244       sign.   The  name  is  the  name  of  the tag type, except in arbitrary
245       upper/lower case.  One place to see the names of TIFF tag types  is  in
246       the TIFF library's tiff.h file, where there is a macro defined for each
247       consisting of 'TIFF_' plus the name.   E.g.  for  the  SUBFILETYPE  tag
248       type, there is a macro TIFF_SUBFILETYPE.
249
250       The  format of the value specification for a tag (stuff after the equal
251       sign) depends upon what kind of value the tag type has:
252
253
254
255       ·      Integer: a decimal number
256
257
258       ·      Floating point number: a decimal number
259
260
261       ·      String: a string
262
263
264       ·      Enumerated (For example, a 'subfiletype' tag takes an enumerated
265              value.   Its possible values are REDUCEDIMAGE, PAGE, and MASK.):
266              The name of the value.  You can see the possible value names  in
267              the  TIFF library's tiff.h foile, where there is a macro defined
268              for each consisting of a qualifier plus the  value  name.   E.g.
269              for  the  REDUCEDIMAGE  value  of a SUBFILETYPE tag, you see the
270              macro FILETYPE_REDUCEDIMAGE.
271
272              The TIFF format assigns a unique number to each enumerated value
273              and  you can specify that number, in decimal, as an alternative.
274              This is useful if you are using an extension of TIFF that pamto‐
275              tiff doesn't know about.
276
277
278
279       If you specify a tag type with -tag that is not independent of the con‐
280       tent of your PNM source image and pamtotiff's conversion process  (i.e.
281       a  tag  type  in  which pamtotiff is interested), pamtotiff fails.  For
282       example, you cannot specify an IMAGEWIDTH tag with -tag, because pamto‐
283       tiff  generates  an  IMAGEWIDTH  tag that gives the actual width of the
284       image.
285
286       -tag was new in Netpbm 10.31 (December 2005).
287
288
289   Other
290       You can use the -rowsperstrip option to set the number of  rows  (scan‐
291       lines)  in each strip of data in the output file.  By default, the out‐
292       put file has the number of rows per strip set  to  a  value  that  will
293       ensure each strip is no more than 8 kilobytes long.
294
295       The -append option tells pamtotiff to add images to the existing output
296       file (a TIFF file may contain multiple images) instead of the  default,
297       which is to replace the output file.
298
299       -append was new in Netpbm 10.27 (March 2005).
300
301
302

NOTES

304       There are myriad variations of the TIFF format, and this program gener‐
305       ates only a few of them.  pamtotiff creates a grayscale  TIFF  file  if
306       its  input  is  a PBM (monochrome) or PGM (grayscale) or equivalent PAM
307       file.  pamtotiff also creates a grayscale  file  if  it  input  is  PPM
308       (color) or equivalent PAM, but there is only one color in the image.
309
310       If  the  input is a PPM (color) file and there are 256 colors or fewer,
311       but more than 1, pamtotiff generates a color  palette  TIFF  file.   If
312       there  are more colors than that, pamtotiff generates an RGB (not RGBA)
313       single plane TIFF  file.   Use  pnmtotiffcmyk  to  generate  the  cyan-
314       magenta-yellow-black ink color separation TIFF format.
315
316       The  number  of bits per sample in the TIFF output is determined by the
317       maxval of the Netpbm input.  If the maxval is less than 256,  the  bits
318       per  sample  in  the  output is the smallest number that can encode the
319       maxval.  If the maxval is greater than or equal to 256,  there  are  16
320       bits per sample in the output.
321
322
323   Extra Channels
324       Like  most Netpbm programs, pamtotiff's function is mostly undefined if
325       the input is PAM  image  with  tuple  type  other  than  BLACKANDWHITE,
326       GRAYSCALE,  or  RGB.   Most of the statements in this manual assume the
327       input is not such an exotic PAM.  But there is a  little  defined  pro‐
328       cessing of other PAM subformats.
329
330       pamtotiff  assumes  any 1 plane PAM image is BLACKANDWHITE or GRAYSCALE
331       (and doesn't distinguish between those two).
332
333       pamtotiff assumes a PAM with more than 1 plane is  of  tuple  type  RGB
334       except  with  that  number  of  planes instead of 3.  pamtotiff doesn't
335       really understand red, green, and blue, so it has  no  trouble  with  a
336       2-component  or  5-component  color  space.   The TIFF format allows an
337       arbitrary number of color compoonents, so pamtotiff simply maps the PAM
338       planes directly to TIFF color components.  I don't know if the meanings
339       of 5 components in a TIFF image are standard at all, but  the  function
340       is there if you want to use it.
341
342       Note  that  pamtotiff  may  generate  either a truecolor or colormapped
343       image with an arbitrary number of color components.  In  the  truecolor
344       case,  the  raster has that number of planes.  In the colormapped case,
345       the raster has of course 1 plane, but the color map has all  the  color
346       components in it.
347
348       The most common reason for a PAM to have extra planes is when the tuple
349       type is xxx_ALPHA, which means the highest numbered plane is  a  trans‐
350       parency  plane  (alpha  channel).   At least one user found that a TIFF
351       with an extra plane for transparency was useful.
352
353       Note that the grayscale detection works on N-component  colors,  so  if
354       your planes aren't really color components, you'll want to disable this
355       via the -color option.
356
357
358
359   Multiple Passes
360       pamtotiff reads the input image once if it can,  and  otherwise  twice.
361       It  needs  that  second  pass  (which  happens before the main pass, of
362       course) to analyze the colors in the image and  generate  a  color  map
363       (palette)  and determine if the image is grayscale.  So the second pass
364       happens only when the input is PPM.  And you can avoid it then by spec‐
365       ifying both the -truecolor and -color options.
366
367        If the input image is small enough to fit in your system's file cache,
368       the second pass is very fast.  If not, it requires  reading  from  disk
369       twice, which can be slow.
370
371       When the input is from a file that cannot be rewound and reread, pamto‐
372       tiff reads the entire input image into a temporary file which can,  and
373       works from that.  Even if it needs only one pass.
374
375       Before  Netpbm  9.21  (December 2001), pamtotiff always read the entire
376       image into virtual memory and  then  did  one,  two,  or  three  passes
377       through  the  memory  copy.   The -truecolor and -color options did not
378       exist.  The passes through memory would  involve  page  faults  if  the
379       entire  image  did  not  fit  into  real  memory.   The image in memory
380       required considerably more memory (12 bytes per pixel) than the  cached
381       file version of the image would.
382
383
384
385   Resolution
386       A Tiff image may contain information about the resolution of the image,
387       which means how big in real dimensions (centimeters, etc.)  each  pixel
388       in  the raster is.  That information is in the TIFF XRESOLUTION, YRESO‐
389       LUTION, and  RESOLUTIONUNIT  tags.   By  default,  pamtotiff  does  not
390       include  any  tags  of  these  types, but you can specify them with the
391       -tags option.
392
393       There are also options -xresolution, -yresolution, and -resolutionunit,
394       but  those  are  obsolete.   Before  -tags existed (before Netpbm 10.31
395       (December 2005), they were the only way.
396
397       Note that the number of pixels in the image and  how  much  information
398       each contains is determined independently from the setting of the reso‐
399       lution tags.  The number of pixels in the output is the same as in  the
400       input,  and each pixel contains the same information.  For your resolu‐
401       tion tags to be meaningful, they have to consistent with whatever  cre‐
402       ated  the  PNM  input.   E.g.  if a scanner turned a 10 centimeter wide
403       image into a 1000 pixel wide PNM image, then your horizontal resolution
404       is 100 pixels per centimeter, and if your XRESOLUTION tag says anything
405       else, something that prints your TIFF image won't print the  proper  10
406       centimeter image.
407
408       The  value  of  the  XRESOLUTION tag is a floating point decimal number
409       that tells how many pixels there are per unit of distance in the  hori‐
410       zontal  direction.   -yresolution  is analogous for the vertical direc‐
411       tion.
412
413       The unit of distance is  given  by  the  value  of  the  RESOLUTIONUNIT
414       option.   That  value  is either INCH, CENTIMETER, or NONE.  NONE means
415       the unit is arbitrary or unspecified.  This could mean that the creator
416       and user of the image have a separate agreement as to what the unit is.
417       But usually, it just means that the horizontal and vertical  resolution
418       values  cannot  be  used  for anything except to determine aspect ratio
419       (because even though the unit is arbitrary or unspecified, it has to be
420       the same for both resolution numbers).
421
422       If  you  don't  use a -tag option to specify the resolution tag and use
423       the obsolete options instead, note the following:
424
425
426
427       ·      If you don't include an specify  -xresolution,  the  Tiff  image
428              does  not  contain  horizontal resolution information.  Likewise
429              for -yresolution.  If you  don't  specify  -resolutionunit,  the
430              default is inches.
431
432
433       ·      Before  Netpbm  10.16 (June 2003), -resolutionunit did not exist
434              and the resolution unit was always inches.
435
436
437
438

HISTORY

440       pamtotiff was originally pnmtotiff and did not handle  PAM  input.   It
441       was extended and renamed in Netpbm 10.30 (October 2005).
442
443
444

SEE ALSO

446       tifftopnm(1), pnmtotiffcmyk(1), pamdepth(1), pamtopnm(1), pam(1)
447
448

AUTHOR

450       Derived  by  Jef Poskanzer from ras2tiff.c, which is Copyright (c) 1990
451       by   Sun   Microsystems,   Inc.    Author:    Patrick    J.    Naughton
452       (naughton@wind.sun.com).
453
454
455
456netpbm documentation             27 March 2005        Pamtotiff User Manual(0)
Impressum