| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN"> |
| 2 |
<html><head><title>Pamtotiff User Manual</title></head> |
| 3 |
<body> |
| 4 |
<h1>pamtotiff</h1> |
| 5 |
Updated: 05 April 2017 |
| 6 |
<br> |
| 7 |
<a href="#index">Table Of Contents</a> |
| 8 |
|
| 9 |
<h2>NAME</h2> |
| 10 |
pamtotiff - convert a Netpbm image to a TIFF file |
| 11 |
|
| 12 |
<h2 id="synopsis">SYNOPSIS</h2> |
| 13 |
|
| 14 |
<b>pamtotiff</b> |
| 15 |
|
| 16 |
[<b>-none</b> | <b>-packbits</b> | <b>-lzw</b> | <b>-g3</b> | <b>-g4</b> |
| 17 |
| <b>-flate</b> | <b>-adobeflate</b>] |
| 18 |
|
| 19 |
[<b>-2d</b>] |
| 20 |
|
| 21 |
[<b>-fill</b>] |
| 22 |
|
| 23 |
[<b>-predictor=</b><i>n</i>] |
| 24 |
|
| 25 |
[<b>-msb2lsb</b>|<b>-lsb2msb</b>] |
| 26 |
|
| 27 |
[<b>-rowsperstrip=</b><i>n</i>] |
| 28 |
|
| 29 |
[<b>-minisblack</b>|<b>-miniswhite</b>|<b>mb</b>|<b>mw</b>] |
| 30 |
|
| 31 |
[<b>-truecolor</b>] |
| 32 |
|
| 33 |
[<b>-color</b>] |
| 34 |
|
| 35 |
[<b>-indexbits=</b><i>bitwidthlist</i>] |
| 36 |
|
| 37 |
<br> |
| 38 |
[<b>-xresolution=</b><i>xres</i>] |
| 39 |
|
| 40 |
[<b>-yresolution=</b><i>yres</i>] |
| 41 |
|
| 42 |
<br> |
| 43 |
[<b>-resolutionunit=</b>{<b>inch</b> | <b>centimeter</b> | <b>none</b> | |
| 44 |
<b>in</b> | <b>cm</b> | <b>no</b>}] |
| 45 |
|
| 46 |
[<b>-append</b>] |
| 47 |
|
| 48 |
[<b>-tag=</b><i>taglist</i>] |
| 49 |
|
| 50 |
[<i>pamfile</i>] |
| 51 |
|
| 52 |
<p>You can use the minimum unique abbreviation of the options. You |
| 53 |
can use two hyphens instead of one. You can separate an option name |
| 54 |
from its value with white space instead of an equals sign. |
| 55 |
|
| 56 |
<h2 id="description">DESCRIPTION</h2> |
| 57 |
|
| 58 |
<p>This program is part of <a href="index.html">Netpbm</a>. |
| 59 |
|
| 60 |
<p><b>pamtotiff</b> reads a PNM or PAM image as input and produces a TIFF file |
| 61 |
as output. |
| 62 |
|
| 63 |
<p>Actually, it handles multi-image Netpbm streams, producing multi-image |
| 64 |
TIFF streams (i.e. a TIFF stream with multiple |
| 65 |
"directories"). But before Netpbm 10.27 (March 2005), it |
| 66 |
ignored all but the first Netpbm image in the input stream. |
| 67 |
|
| 68 |
<h3 id="output">The Output File</h3> |
| 69 |
|
| 70 |
<p>By default, the output goes to Standard Output. Alternatively, you can |
| 71 |
specify an output file with the <b>-output</b> option and <b>pamtotiff</b> |
| 72 |
will write its output directly to that file. |
| 73 |
|
| 74 |
<p>Because of the way the TIFF library (which <b>pamtotiff</b> uses) works, |
| 75 |
when the program writes to Standard Output, it generates the entire TIFF image |
| 76 |
in a temporary file and then copies it to Standard Output; you may see |
| 77 |
negative performance effects of this. |
| 78 |
|
| 79 |
<p>The <b>-output</b> method avoids the performance effects of the copy |
| 80 |
through the temporary file, but there are restrictions on the output file: it |
| 81 |
must be seekable and it must be readable. The program fails if it is not. |
| 82 |
With Standard Output, neither of those restrictions applies. |
| 83 |
|
| 84 |
<p>With <b>-output</b>, if the file already exists and has data in it, |
| 85 |
<b>pamtotiff</b> appends the image to the existing TIFF file. (A TIFF file |
| 86 |
may contain multiple images). |
| 87 |
|
| 88 |
<p>By default, <b>pamtotiff</b> creates the file named by <b>-output</b> if it |
| 89 |
does not already exist. But if you also specify <b>-append</b>, the program |
| 90 |
fails if the file named by <b>-output</b> does not already exist. |
| 91 |
|
| 92 |
<p>Before Netpbm 10.67 (June 2014), there is no <b>-output</b> option and |
| 93 |
Standard Output must be seekable. So pipes are out. |
| 94 |
|
| 95 |
<p>Before Netpbm 10.67 (June 2014), you could append to Standard Output. See |
| 96 |
below. The current program does not have the ability; you must |
| 97 |
use <b>-output</b> to append to an existing TIFF file. |
| 98 |
|
| 99 |
<p>The difference above means current <b>pamtotiff</b> is actually not |
| 100 |
backward compatible, which is a rare thing for Netpbm. But it's a good thing |
| 101 |
because the previous function was very strange and probably hardly ever |
| 102 |
exploited. |
| 103 |
|
| 104 |
|
| 105 |
<h4 id="oldoutput">Old Versions</h4> |
| 106 |
|
| 107 |
<p>As alluded to above, <b>pamtotiff</b> does output very differently |
| 108 |
in releases before 10.67. The following describes the old function, |
| 109 |
which is unusual both for Netpbm and for Unix programs in general. |
| 110 |
|
| 111 |
<ul> |
| 112 |
<li>The output file must be seekable. <b>pamtotiff</b> does not |
| 113 |
write it sequentially. Therefore, you can't use a pipe; you can't |
| 114 |
pipe the output of <b>pamtotiff</b> to some other program. But any |
| 115 |
regular file should work. |
| 116 |
|
| 117 |
<li>If the output file descriptor is readable, you must either specify |
| 118 |
<b>-append</b> so as to add to the existing file, or make sure the |
| 119 |
file is empty. Otherwise, <b>pamtotiff</b> will fail with an |
| 120 |
unhelpful message telling you that a TIFF library function failed to |
| 121 |
open the TIFF output stream. |
| 122 |
|
| 123 |
<li>If you are converting multiple images (your input stream contains |
| 124 |
multiple images), the output file must be both readable and writable. |
| 125 |
|
| 126 |
</ul> |
| 127 |
|
| 128 |
<p>If you're using a Unix command shell to run <b>pamtotiff</b>, you |
| 129 |
use facilities of your shell to set up Standard Output. In Bash, |
| 130 |
for example, you would set up a write-only Standard Output to the |
| 131 |
file /tmp/myimage.tiff like this: |
| 132 |
|
| 133 |
<pre> |
| 134 |
<kbd> |
| 135 |
$ pamtotiff myimage.pnm >/tmp/myimage.tiff |
| 136 |
</kbd> |
| 137 |
</pre> |
| 138 |
|
| 139 |
In Bash, you would set up a read/write Standard Output to the file |
| 140 |
/tmp/myimage.tiff like this: |
| 141 |
|
| 142 |
<pre> |
| 143 |
<kbd> |
| 144 |
$ pamtotiff myimage.pnm 1<>/tmp/myimage.tiff |
| 145 |
</kbd> |
| 146 |
</pre> |
| 147 |
|
| 148 |
<h3 id="library">TIFF Capability</h3> |
| 149 |
|
| 150 |
<p><b>pamtotiff</b> uses the Libtiff.org TIFF library (or whatever |
| 151 |
equivalent you provide) to generate the TIFF output. Details of the |
| 152 |
format it produces are therefore controlled by that library. |
| 153 |
|
| 154 |
<h2 id="options">OPTIONS</h2> |
| 155 |
|
| 156 |
<p>In addition to the options common to all programs based on libnetpbm |
| 157 |
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions"> |
| 158 |
Common Options</a>), <b>pamtotiff</b> recognizes the following |
| 159 |
command line options: |
| 160 |
|
| 161 |
<h3 id="compression">Compression</h3> |
| 162 |
|
| 163 |
<p>By default, <b>pamtotiff</b> creates a TIFF file with no |
| 164 |
compression. This is your best bet most of the time. If you want to |
| 165 |
try another compression scheme or tweak some of the other even more |
| 166 |
obscure output options, there are a number of options which to |
| 167 |
play. |
| 168 |
|
| 169 |
<p>Before Netpbm 8.4 (April 2000), the default was to use LZW compression. |
| 170 |
But then new releases of the TIFF library started omitting the LZW |
| 171 |
compression capability because of concern about patents on LZW. So |
| 172 |
since then, the default has been no compression. The LZW patents have |
| 173 |
now expired and new TIFF libraries do LZW, but the <b>pamtotiff</b> |
| 174 |
behavior remains the same for compatibility with older TIFF libraries |
| 175 |
and applications of <b>pamtotiff</b>. |
| 176 |
|
| 177 |
<p>The <b>-none</b>, <b>-packbits</b>, <b>-lzw</b>, <b>-g3</b>, |
| 178 |
<b>-g4</b>, <b>-flate</b>, and <b>-adobeflate</b> options are used to |
| 179 |
override the default and set the compression scheme used in creating |
| 180 |
the output file. |
| 181 |
|
| 182 |
The <b>-predictor</b> option is meaningful only with LZW compression: a |
| 183 |
predictor value of 2 causes each scanline of the output image to undergo |
| 184 |
horizontal differencing before it is encoded; a value of 1 forces each |
| 185 |
scanline to be encoded without differencing. By default, <b>pamtotiff</b> |
| 186 |
creates a TIFF file with msb-to-lsb fill order. The <b>-msb2lsb</b> and |
| 187 |
<b>-lsb2msb</b> options are used to override the default and set the fill |
| 188 |
order used in creating the file. |
| 189 |
|
| 190 |
<p>With some older TIFF libraries, <b>-lzw</b> doesn't work because |
| 191 |
the TIFF library doesn't do LZW compression. This is because of |
| 192 |
concerns about Unisys's patent on LZW which was then in force. |
| 193 |
Actually, with very old TIFF libraries, <b>-lzw</b> works because no |
| 194 |
distributors of the TIFF library were sensitive yet to the patent |
| 195 |
issue. |
| 196 |
|
| 197 |
<p><b>-flate</b> chooses "flate" compression, which is the |
| 198 |
patent-free compression common in the Unix world implemented by the |
| 199 |
"Z" library. It is what the PNG format uses. |
| 200 |
|
| 201 |
<h4 id="faxcompression">Fax Compression</h4> |
| 202 |
|
| 203 |
<p>If you have bilevel data (e.g. PBM), you can generate a TIFF that uses the |
| 204 |
same compression scheme specified for use by fax machines. See the <a |
| 205 |
href="faxformat.html">Fax Format</a> page for more information on these |
| 206 |
compression schemes. |
| 207 |
|
| 208 |
<p>These formats all relate to ITU Group 3 and Group 4 fax machine |
| 209 |
standards. |
| 210 |
|
| 211 |
<p>The <b>-g3</b> option chooses MH or MR compression: MR with the additional |
| 212 |
option <b>-2d</b>; MH without it. <b>-g4</b> selects MMR. The option names |
| 213 |
are a little unfortunate and historical, but are consistent with the TIFF |
| 214 |
specification. |
| 215 |
|
| 216 |
<p>MMR has a better compression ratio than the other two. |
| 217 |
|
| 218 |
<p><b>-fill</b> specifies that for MH or MR compression, each encoded scanline |
| 219 |
shall be zero-filled to a byte boundary. |
| 220 |
|
| 221 |
<p><b>-2d</b> and <b>-fill</b> are meaningful only with <b>-g3</b>. |
| 222 |
|
| 223 |
|
| 224 |
<h3 id="fillorder">Fill Order</h3> |
| 225 |
<p>The <b>-msb2lsb</b> and <b>lsb2msb</b> options control the fill order. |
| 226 |
|
| 227 |
<p>The fill order is the order in which pixels are packed into a byte in |
| 228 |
the Tiff raster, in the case that there are multiple pixels per byte. |
| 229 |
msb-to-lsb means that the leftmost columns go into the most |
| 230 |
significant bits of the byte in the Tiff image. However, there is |
| 231 |
considerable confusion about the meaning of fill order. Some believe |
| 232 |
it means whether 16 bit sample values in the Tiff image are |
| 233 |
little-endian or big-endian. This is totally erroneous (The |
| 234 |
endianness of integers in a Tiff image is designated by the image's |
| 235 |
magic number). However, ImageMagick and older Netpbm both have been known |
| 236 |
to implement that interpretation. 2001.09.06. |
| 237 |
|
| 238 |
<p>If the image does not have sub-byte pixels, these options have no |
| 239 |
effect other than to set the value of the FILLORDER tag in the Tiff |
| 240 |
image (which may be useful for those programs that misinterpret the |
| 241 |
tag with reference to 16 bit samples). |
| 242 |
|
| 243 |
<h3 id="colorspace">Color Space</h3> |
| 244 |
|
| 245 |
<p><b>-color</b> tells <b>pamtotiff</b> to produce a color, as |
| 246 |
opposed to grayscale, TIFF image if the input is PPM, even if it |
| 247 |
contains only shades of gray. Without this option, <b>pamtotiff</b> |
| 248 |
produces a grayscale TIFF image if the input is PPM and contains only |
| 249 |
shades of gray, and at most 256 shades. Otherwise, it produces a |
| 250 |
color TIFF output. For PBM and PGM input, <b>pamtotiff</b> always |
| 251 |
produces grayscale TIFF output and this option has no effect. |
| 252 |
|
| 253 |
<p>The <b>-color</b> option can prevent <b>pamtotiff</b> from making |
| 254 |
two passes through the input file, thus improving speed and memory |
| 255 |
usage. See <a href="#multipass">Multiple Passes</a>. |
| 256 |
|
| 257 |
<p><b>-truecolor</b> tells <b>pamtotiff</b> to produce the 24-bit RGB |
| 258 |
form of TIFF output if it is producing a color TIFF image. Without |
| 259 |
this option, <b>pamtotiff</b> produces a colormapped (paletted) TIFF |
| 260 |
image unless there are more than 256 colors (and in the latter case, |
| 261 |
issues a warning). |
| 262 |
|
| 263 |
<p>The <b>-truecolor</b> option can prevent <b>pamtotiff</b> from |
| 264 |
making two passes through the input file, thus improving speed and |
| 265 |
memory usage. See <a href="#multipass">Multiple Passes</a>. |
| 266 |
|
| 267 |
<p>The <b>-color</b> and <b>-truecolor</b> options did not exist |
| 268 |
before Netpbm 9.21 (December 2001). |
| 269 |
|
| 270 |
<p>If <b>pamtotiff</b> produces a grayscale TIFF image, this option |
| 271 |
has no effect. |
| 272 |
|
| 273 |
<p>The <b>-minisblack</b> and <b>-miniswhite</b> options force the |
| 274 |
output image to have a "minimum is black" or "minimum |
| 275 |
is white" photometric, respectively. If you don't specify |
| 276 |
either, <b>pamtotiff</b> uses minimum is black except when using Group |
| 277 |
3 or Group 4 compression, in which case <b>pamtotiff</b> follows CCITT |
| 278 |
fax standards and uses "minimum is white." This usually |
| 279 |
results in better compression and is generally preferred for bilevel |
| 280 |
coding. These photometrics are for grayscale images, so these options are |
| 281 |
invalid if the image is color (but only if it is truly color; they are |
| 282 |
valid with, for example, a PPM image that contains only shades of gray). |
| 283 |
|
| 284 |
<p>Before Netpbm 9.11 (February 200)1, <b>pamtotiff</b> always produced |
| 285 |
"minimum is black," because of a bug. In either case, |
| 286 |
<b>pamtotiff</b> sets the photometric interpretation tag in the TIFF |
| 287 |
output according to which photometric is actually used. |
| 288 |
|
| 289 |
<p>Before Netpbm 10.78 (March 2017), <b>pamtotiff</b> respected |
| 290 |
<b>-miniswhite</b> and <b>-minisblack</b> even with color images, producing |
| 291 |
invalid TIFF images that have the indicated photometric but red, green, and |
| 292 |
blue raster planes. |
| 293 |
|
| 294 |
<p>The <b>-indexbits</b> option is meaningful only for a colormapped |
| 295 |
(paletted) image. In this kind of image, the raster contains values |
| 296 |
which are indexes into a table of colors, with the indexes normally |
| 297 |
taking less space that the color description in the table. |
| 298 |
<b>pamtotiff</b> can generate indexes of 1, 2, 4, or 8 bits. By |
| 299 |
default, it will use 8, because many programs that interpret TIFF |
| 300 |
images can't handle any other width. |
| 301 |
|
| 302 |
<p>But if you have a small number of colors, you can make your image |
| 303 |
considerably smaller by allowing fewer than 8 bits per index, using the |
| 304 |
<b>-indexbits</b> option. The value is a comma-separated list of the |
| 305 |
bit widths you allow. <b>pamtotiff</b> chooses the smallest width you allow |
| 306 |
that allows it to index the entire color table. If you don't allow any |
| 307 |
such width, <b>pamtotiff</b> fails. Normally, the only useful value for |
| 308 |
this option is <b>1,2,4,8</b>, because a program either understands the 8 |
| 309 |
bit width (default) or understands them all. |
| 310 |
|
| 311 |
<p>In a Baseline TIFF image, according to the 1992 TIFF 6.0 |
| 312 |
specification, 4 and 8 are the only valid widths. There are no formal |
| 313 |
standards that allow any other values. |
| 314 |
|
| 315 |
<p>This option was added in June 2002. Before that, only 8 bit indices were |
| 316 |
possible. |
| 317 |
|
| 318 |
<h3 id="extratags">Extra Tags</h3> |
| 319 |
|
| 320 |
<p>There are lots of tag types in the TIFF format that don't correspond to |
| 321 |
any information in the PNM format or to anything in the conversion process. |
| 322 |
For example, a TIFF_ARTIST tag names the artist who created the image. |
| 323 |
|
| 324 |
<p>You can tell <b>pamtotiff</b> explicitly to include tags such as this |
| 325 |
in its output with the <b>-tag</b> option. You identify a list of tag |
| 326 |
types and values and <b>pamtotiff</b> includes a tag in the output for |
| 327 |
each item in your list. |
| 328 |
|
| 329 |
<p>The value of <b>-tag</b> is the list of tags, like this example: |
| 330 |
|
| 331 |
<pre> |
| 332 |
<code> |
| 333 |
-tag=subfiletype=reducedimage,documentname=Fred,xposition=25 |
| 334 |
</code> |
| 335 |
</pre> |
| 336 |
|
| 337 |
<p>As you see, it is a list of tag specifications separated by commas. |
| 338 |
Each tag specification is a name and a value separated by an equal |
| 339 |
sign. The name is the name of the tag type, except in arbitrary |
| 340 |
upper/lower case. One place to see the names of TIFF tag types is in |
| 341 |
the TIFF library's <b>tiff.h</b> file, where there is a macro defined |
| 342 |
for each consisting of "TIFF_" plus the name. E.g. for |
| 343 |
the SUBFILETYPE tag type, there is a macro TIFF_SUBFILETYPE. |
| 344 |
|
| 345 |
<p>The format of the value specification for a tag (stuff after the |
| 346 |
equal sign) depends upon what kind of value the tag type has: |
| 347 |
|
| 348 |
<ul> |
| 349 |
<li>Integer: a decimal number |
| 350 |
|
| 351 |
<li>Floating point number: a decimal number |
| 352 |
|
| 353 |
<li>String: a string |
| 354 |
|
| 355 |
<li>Enumerated (For example, a 'subfiletype' tag takes an enumerated |
| 356 |
value. Its possible values are REDUCEDIMAGE, PAGE, and MASK.): The |
| 357 |
name of the value. You can see the possible value names in the TIFF |
| 358 |
library's <b>tiff.h</b> file, where there is a macro defined for each |
| 359 |
consisting of a qualifier plus the value name. E.g. for the |
| 360 |
REDUCEDIMAGE value of a SUBFILETYPE tag, you see the macro |
| 361 |
FILETYPE_REDUCEDIMAGE. |
| 362 |
|
| 363 |
<p>The TIFF format assigns a unique number to each enumerated value and |
| 364 |
you can specify that number, in decimal, as an alternative. This is useful |
| 365 |
if you are using an extension of TIFF that <b>pamtotiff</b> doesn't |
| 366 |
know about. |
| 367 |
|
| 368 |
</ul> |
| 369 |
|
| 370 |
<p>If you specify a tag type with <b>-tag</b> that is not independent |
| 371 |
of the content of your PNM source image and <b>pamtotiff</b>'s |
| 372 |
conversion process (i.e. a tag type in which <b>pamtotiff</b> is |
| 373 |
interested), <b>pamtotiff</b> fails. For example, you cannot specify |
| 374 |
an IMAGEWIDTH tag with <b>-tag</b>, because <b>pamtotiff</b> generates |
| 375 |
an IMAGEWIDTH tag that gives the actual width of the image. |
| 376 |
|
| 377 |
<p><b>-tag</b> was new in Netpbm 10.31 (December 2005). |
| 378 |
|
| 379 |
<h3 id="outputoptions">Output</h3> |
| 380 |
|
| 381 |
<p>See <a href="#output">The Output File</a>. |
| 382 |
|
| 383 |
<p><b>-output</b> names the output file. Without this option |
| 384 |
<b>pamtotiff</b> writes to Standard Output. |
| 385 |
|
| 386 |
<p>The <b>-append</b> option tells <b>pamtotiff</b> only to append to the file |
| 387 |
named by <b>output</b>; not create it. Without this option, the program |
| 388 |
creates the file it does not already exist. But even then, if the file does |
| 389 |
already exist, the program appends the image to what is in the file already. |
| 390 |
(A TIFF file may contain multiple images). |
| 391 |
|
| 392 |
<p><b>-append</b> has no effect if you don't also specify <b>-output</b>. |
| 393 |
|
| 394 |
<p>Before Netpbm 10.67 (June 2014), <b>-append</b> means something rather |
| 395 |
different: it means to append the image to the output TIFF file (which is |
| 396 |
always Standard Output in 10.67) instead of replacing its contents. |
| 397 |
|
| 398 |
<p><b>-append</b> was new in Netpbm 10.27 (March 2005). |
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
<h3 id="other">Other</h3> |
| 403 |
|
| 404 |
<p>You can use the <b>-rowsperstrip</b> option to set the number of |
| 405 |
rows (scanlines) in each strip of data in the output file. By |
| 406 |
default, the output file has the number of rows per strip set to a |
| 407 |
value that will ensure each strip is no more than 8 kilobytes long. |
| 408 |
|
| 409 |
|
| 410 |
<h2 id="notes">NOTES</h2> |
| 411 |
|
| 412 |
<p>There are myriad variations of the TIFF format, and this program |
| 413 |
generates only a few of them. <b>pamtotiff</b> creates a grayscale |
| 414 |
TIFF file if its input is a PBM (monochrome) or PGM (grayscale) or |
| 415 |
equivalent PAM file. <b>pamtotiff</b> also creates a grayscale file |
| 416 |
if it input is PPM (color) or equivalent PAM, but there is only one |
| 417 |
color in the image. |
| 418 |
|
| 419 |
<p>If the input is a PPM (color) file and there are 256 colors or |
| 420 |
fewer, but more than 1, <b>pamtotiff</b> generates a color palette |
| 421 |
TIFF file. If there are more colors than that, <b>pamtotiff</b> |
| 422 |
generates an RGB (not RGBA) single plane TIFF file. Use |
| 423 |
<b>pnmtotiffcmyk</b> to generate the cyan-magenta-yellow-black ink |
| 424 |
color separation TIFF format. |
| 425 |
|
| 426 |
<p>The number of bits per sample in the TIFF output is determined by |
| 427 |
the maxval of the Netpbm input. If the maxval is less than 256, the bits |
| 428 |
per sample in the output is the smallest number that can encode the |
| 429 |
maxval. If the maxval is greater than or equal to 256, there are 16 |
| 430 |
bits per sample in the output. |
| 431 |
|
| 432 |
<h3 id="extrachannel">Extra Channels</h3> |
| 433 |
|
| 434 |
<p>Like most Netpbm programs, <b>pamtotiff</b>'s function is mostly |
| 435 |
undefined if the input is PAM image with tuple type other than |
| 436 |
BLACKANDWHITE, GRAYSCALE, or RGB. Most of the statements in this manual |
| 437 |
assume the input is not such an exotic PAM. But there is a little |
| 438 |
defined processing of other PAM subformats. |
| 439 |
|
| 440 |
<p><b>pamtotiff</b> assumes any 1 plane PAM image is BLACKANDWHITE |
| 441 |
or GRAYSCALE (and doesn't distinguish between those two). |
| 442 |
|
| 443 |
<p><b>pamtotiff</b> assumes a PAM with more than 1 plane is of tuple |
| 444 |
type RGB except with that number of planes instead of 3. |
| 445 |
<b>pamtotiff</b> doesn't really understand red, green, and blue, so it |
| 446 |
has no trouble with a 2-component or 5-component color space. The |
| 447 |
TIFF format allows an arbitrary number of color components, so |
| 448 |
<b>pamtotiff</b> simply maps the PAM planes directly to TIFF color |
| 449 |
components. I don't know if the meanings of 5 components in a TIFF image |
| 450 |
are standard at all, but the function is there if you want to use it. |
| 451 |
|
| 452 |
<p>Note that <b>pamtotiff</b> may generate either a truecolor or |
| 453 |
colormapped image with an arbitrary number of color components. In |
| 454 |
the truecolor case, the raster has that number of planes. In the |
| 455 |
colormapped case, the raster has of course 1 plane, but the color map |
| 456 |
has all the color components in it. |
| 457 |
|
| 458 |
<p>The most common reason for a PAM to have extra planes is when the tuple |
| 459 |
type is xxx_ALPHA, which means the highest numbered plane is a transparency |
| 460 |
plane (alpha channel). At least one user found that a TIFF with an extra |
| 461 |
plane for transparency was useful. |
| 462 |
|
| 463 |
<p>Note that the grayscale detection works on N-component colors, so if |
| 464 |
your planes aren't really color components, you'll want to disable this |
| 465 |
via the <b>-color</b> option. |
| 466 |
|
| 467 |
|
| 468 |
<h3 id="multipass">Multiple Passes</h3> |
| 469 |
|
| 470 |
<p><b>pamtotiff</b> reads the input image once if it can, and |
| 471 |
otherwise twice. It needs that second pass (which happens before the |
| 472 |
main pass, of course) to analyze the colors in the image and generate |
| 473 |
a color map (palette) and determine if the image is grayscale. So the |
| 474 |
second pass happens only when the input is PPM. And you can avoid it |
| 475 |
then by specifying both the <b>-truecolor</b> and <b>-color</b> |
| 476 |
options. |
| 477 |
|
| 478 |
<p> If the input image is small enough to fit in your system's file |
| 479 |
cache, the second pass is very fast. If not, it requires reading from |
| 480 |
disk twice, which can be slow. |
| 481 |
|
| 482 |
<p>When the input is from a file that cannot be rewound and reread, |
| 483 |
<b>pamtotiff</b> reads the entire input image into a temporary file |
| 484 |
which can, and works from that. Even if it needs only one pass. |
| 485 |
|
| 486 |
<p>Before Netpbm 9.21 (December 2001), <b>pamtotiff</b> always read |
| 487 |
the entire image into virtual memory and then did one, two, or three |
| 488 |
passes through the memory copy. The <b>-truecolor</b> and |
| 489 |
<b>-color</b> options did not exist. The passes through memory would |
| 490 |
involve page faults if the entire image did not fit into real memory. |
| 491 |
The image in memory required considerably more memory (12 bytes per |
| 492 |
pixel) than the cached file version of the image would. |
| 493 |
|
| 494 |
|
| 495 |
<h3 id="resolution">Resolution</h3> |
| 496 |
|
| 497 |
<p>A Tiff image may contain information about the resolution of the image, |
| 498 |
which means how big in real dimensions (centimeters, etc.) each pixel in the |
| 499 |
raster is. That information is in the TIFF XRESOLUTION, YRESOLUTION, |
| 500 |
and RESOLUTIONUNIT tags. By default, <b>pamtotiff</b> does not include |
| 501 |
any tags of these types, but you can specify them with the <b>-tags</b> |
| 502 |
option. |
| 503 |
|
| 504 |
<p>There are also options <b>-xresolution</b>, <b>-yresolution</b>, |
| 505 |
and <b>-resolutionunit</b>, but those are obsolete. Before <b>-tags</b> |
| 506 |
existed (before Netpbm 10.31 (December 2005), they were the only way. |
| 507 |
|
| 508 |
<p>Note that the number of pixels in the image and how much information |
| 509 |
each contains is determined independently from the setting of the |
| 510 |
resolution tags. The number of pixels in the output is the same as in |
| 511 |
the input, and each pixel contains the same information. For your |
| 512 |
resolution tags to be meaningful, they have to consistent with |
| 513 |
whatever created the PNM input. E.g. if a scanner turned a 10 centimeter |
| 514 |
wide image into a 1000 pixel wide PNM image, then your horizontal |
| 515 |
resolution is 100 pixels per centimeter, and if your XRESOLUTION |
| 516 |
tag says anything else, something that prints your TIFF image won't |
| 517 |
print the proper 10 centimeter image. |
| 518 |
|
| 519 |
<p>The value of the XRESOLUTION tag is a floating point decimal number |
| 520 |
that tells how many pixels there are per unit of distance in the |
| 521 |
horizontal direction. <b>-yresolution</b> is analogous for the |
| 522 |
vertical direction. |
| 523 |
|
| 524 |
<p>The unit of distance is given by the value of the RESOLUTIONUNIT |
| 525 |
option. That value is either INCH, CENTIMETER, or NONE. NONE |
| 526 |
means the unit is arbitrary or unspecified. This could mean that the |
| 527 |
creator and user of the image have a separate agreement as to what the |
| 528 |
unit is. But usually, it just means that the horizontal and vertical |
| 529 |
resolution values cannot be used for anything except to determine |
| 530 |
aspect ratio (because even though the unit is arbitrary or |
| 531 |
unspecified, it has to be the same for both resolution numbers). |
| 532 |
|
| 533 |
<p>If you <em>don't</em> use a <b>-tag</b> option to specify the |
| 534 |
resolution tag and use the obsolete options instead, note the |
| 535 |
following: |
| 536 |
|
| 537 |
<ul> |
| 538 |
<li>If you don't include an specify <b>-xresolution</b>, the Tiff image |
| 539 |
does not contain horizontal resolution information. Likewise for |
| 540 |
<b>-yresolution</b>. If you don't specify <b>-resolutionunit</b>, the |
| 541 |
default is inches. |
| 542 |
|
| 543 |
<li>Before Netpbm 10.16 (June 2003), <b>-resolutionunit</b> did not |
| 544 |
exist and the resolution unit was always inches. |
| 545 |
|
| 546 |
</ul> |
| 547 |
|
| 548 |
<h2 id="history">HISTORY</h2> |
| 549 |
|
| 550 |
<p><b>pamtotiff</b> was originally <b>pnmtotiff</b> and did not handle |
| 551 |
PAM input. It was extended and renamed in Netpbm 10.30 (October 2005). |
| 552 |
|
| 553 |
|
| 554 |
<h2 id="seealso">SEE ALSO</h2> |
| 555 |
|
| 556 |
<b><a href="tifftopnm.html">tifftopnm</a></b>, |
| 557 |
|
| 558 |
<b><a href="pnmtotiffcmyk.html">pnmtotiffcmyk</a></b>, |
| 559 |
|
| 560 |
<b><a href="pamdepth.html">pamdepth</a></b>, |
| 561 |
|
| 562 |
<b><a href="pamtopnm.html">pamtopnm</a></b>, |
| 563 |
|
| 564 |
<b><a href="pam.html">pam</a></b> |
| 565 |
|
| 566 |
<h2 id="author">AUTHOR</h2> |
| 567 |
|
| 568 |
Derived by Jef Poskanzer from ras2tiff.c, which is |
| 569 |
Copyright (c) 1990 by Sun Microsystems, Inc. |
| 570 |
Author: Patrick J. Naughton (<a href="mailto:[email protected]">[email protected]</a>). |
| 571 |
|
| 572 |
<hr> |
| 573 |
<h2 id="index">Table Of Contents</h2> |
| 574 |
<ul> |
| 575 |
<li><a href="#synopsis">SYNOPSIS</a> |
| 576 |
<li><a href="#description">DESCRIPTION</a> |
| 577 |
<ul> |
| 578 |
<li><a href="#output">The Output File</a> |
| 579 |
<ul> |
| 580 |
<li><a href="#oldoutput">Old Versions</a> |
| 581 |
</ul> |
| 582 |
<li><a href="#library">TIFF Capability</a> |
| 583 |
</ul> |
| 584 |
<li><a href="#options">OPTIONS</a> |
| 585 |
<ul> |
| 586 |
<li><a href="#compression">Compression</a> |
| 587 |
<ul> |
| 588 |
<li><a href="#faxcompression">Fax Compression</a> |
| 589 |
</ul> |
| 590 |
<li><a href="#fillorder">Fill Order</a> |
| 591 |
<li><a href="#colorspace">Color Space</a> |
| 592 |
<li><a href="#extratags">Extra Tags</a> |
| 593 |
<li><a href="#outputoptions">Output</a> |
| 594 |
<li><a href="#other">Other</a> |
| 595 |
</ul> |
| 596 |
<li><a href="#notes">NOTES</a> |
| 597 |
<ul> |
| 598 |
<li><a href="#extrachannel">Extra Channels</a> |
| 599 |
<li><a href="#multipass">Multiple Passes</a> |
| 600 |
<li><a href="#resolution">Resolution</a> |
| 601 |
</ul> |
| 602 |
<li><a href="#history">HISTORY</a> |
| 603 |
<li><a href="#seealso">SEE ALSO</a> |
| 604 |
<li><a href="#author">AUTHOR</a> |
| 605 |
</ul> |
| 606 |
</body> |
| 607 |
</html> |