| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN"> |
| 2 |
<html><head><title>Pnmtopalm User Manual</title></head> |
| 3 |
<body> |
| 4 |
<h1>pnmtopalm</h1> |
| 5 |
Updated: 25 August 2017 |
| 6 |
<br> |
| 7 |
<a href="#index">Table Of Contents</a> |
| 8 |
|
| 9 |
<h2>NAME</h2> |
| 10 |
pnmtopalm - convert a PNM image to a Palm Bitmap |
| 11 |
|
| 12 |
<h2 id="synopsis">SYNOPSIS</h2> |
| 13 |
|
| 14 |
<b>pnmtopalm</b> |
| 15 |
|
| 16 |
[<b>-verbose</b>] |
| 17 |
|
| 18 |
[<b>-depth=</b><i>N</i>] |
| 19 |
|
| 20 |
[<b>-maxdepth=</b><i>N</i>] |
| 21 |
|
| 22 |
[<b>-colormap</b>] |
| 23 |
|
| 24 |
[<b>-transparent=</b><i>colorspec</i>] |
| 25 |
|
| 26 |
[<b>-density=</b><i>N</i>] |
| 27 |
|
| 28 |
[<b>-offset</b>] |
| 29 |
|
| 30 |
[<b>-withdummy</b>] |
| 31 |
|
| 32 |
<br> |
| 33 |
|
| 34 |
[<b>-scanline_compression</b> | <b>-rle_compression</b> | |
| 35 |
<b>-packbits_compression</b>] |
| 36 |
|
| 37 |
[<i>pnmfile</i>] |
| 38 |
|
| 39 |
<p>Minimum unique abbreviation of option is acceptable. You may use |
| 40 |
double hyphens instead of single hyphen to denote options. You may use |
| 41 |
white space in place of the equals sign to separate an option name |
| 42 |
from its value. |
| 43 |
|
| 44 |
<h2 id="description">DESCRIPTION</h2> |
| 45 |
|
| 46 |
<p>This program is part of <a href="index.html">Netpbm</a>. |
| 47 |
|
| 48 |
<p><b>pnmtopalm</b> reads a PNM image as input, from Standard Input or |
| 49 |
<i>pnmfile</i> and produces a Palm Bitmap as output. |
| 50 |
|
| 51 |
<p>Palm Bitmap files are either grayscale files with 1, 2, or 4 bits per |
| 52 |
pixel, or mapped color files with 8 bit per pixel, or a direct color file with |
| 53 |
16 bits per pixel, and <b>pnmtopalm</b> chooses this color depth based on the |
| 54 |
maxval and number of colors in the input, unless you specify a depth (bits per |
| 55 |
pixel) with <b>-depth</b>. You can also specify a maximum depth |
| 56 |
with <b>-maxdepth</b> to partially constrain <b>pnmtopalm</b>'s choice. Input |
| 57 |
files must have an appropriate number and set of colors for the selected |
| 58 |
output constraints. |
| 59 |
|
| 60 |
<p>This often means that you should run the PNM image through |
| 61 |
<b>pnmquant</b> or <b>pnmremap</b> before you pass it to |
| 62 |
<b>pnmtopalm</b>. Netpbm comes with several colormap files you can |
| 63 |
use with <b>pnmremap</b> for this purpose. They are |
| 64 |
<i>palmgray2.map</i> (4 shades of gray for a depth of 2), |
| 65 |
<i>palmgray4.map</i> (16 shades of gray for a depth of 4), and |
| 66 |
<i>palmcolor8.map</i> (232 colors in default Palm colormap). In a |
| 67 |
standard Netpbm installation, these are in the Netpbm data directory, |
| 68 |
and you can find the Netpbm data directory with a <b>netpbm-config |
| 69 |
--datadir</b> shell command. |
| 70 |
|
| 71 |
<p>Example: |
| 72 |
|
| 73 |
<pre> |
| 74 |
pnmremap myimage.ppm \ |
| 75 |
-mapfile=$(netpbm-config --datadir)/palmgray2.map \ |
| 76 |
| pnmtopalm -depth=2 >myimage.palm |
| 77 |
|
| 78 |
</pre> |
| 79 |
|
| 80 |
<p>Compressed Palm Bitmap files, at least the ones <b>pnmtopalm</b> knows how |
| 81 |
to create, cannot have more than 8 bits per pixel. <b>pnmtopalm</b> defaults |
| 82 |
to 8 bits per pixel if you specify a compressed output. You can specify the |
| 83 |
number of bits per pixel explicitly with <b>-depth</b>. <b>-maxdepth</b> |
| 84 |
has the same effect as <b>-depth</b>. If you specify more than 8 bits per |
| 85 |
pixel with either of these, <b>pnmtopalm</b> fails. |
| 86 |
|
| 87 |
<h3 id="version">Palm Bitmap Version</h3> |
| 88 |
|
| 89 |
<p><b>pnmtopalm</b> generates a Version 0, 1, 2, or 3 Palm Bitmap. |
| 90 |
It generates the oldest (lowest) version it can for the given image and |
| 91 |
the options you specify. |
| 92 |
|
| 93 |
<ul> |
| 94 |
<li>If you specify a density (<b>-density</b> option) higher than |
| 95 |
"low," the version is at least 3. |
| 96 |
|
| 97 |
<li>If you specify transparency (<b>-transparent</b> option) or |
| 98 |
any compression, the version is at least 2. |
| 99 |
|
| 100 |
<li>If you specify a custom colormap (<b>-colormap</b> option), the |
| 101 |
version is at least 1. |
| 102 |
|
| 103 |
<li>If the image has more than one bit per pixel, the version is at least |
| 104 |
1. The image has more than one bit per pixel if you specify it with |
| 105 |
<b>-depth</b> or if you let it default and the image has more than |
| 106 |
two colors (or shades of gray). |
| 107 |
|
| 108 |
</ul> |
| 109 |
|
| 110 |
<p>All releases of Palm OS can read a Version 0 bitmap. Palm OS 3.0 and |
| 111 |
later can read a Version 1 bitmap. Palm OS 3.5 and later can read a |
| 112 |
Version 2 bitmap. To read a Version 3 bitmap, you need Palm OS Garnet |
| 113 |
or a handheld running the High Density Display Feature Set. |
| 114 |
|
| 115 |
<h2 id="options">OPTIONS</h2> |
| 116 |
|
| 117 |
<p>In addition to the options common to all programs based on libnetpbm |
| 118 |
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions"> |
| 119 |
Common Options</a>), <b>pnmtopalm</b> recognizes the following |
| 120 |
command line options: |
| 121 |
|
| 122 |
<dl compact> |
| 123 |
<dt><b>-verbose</b> |
| 124 |
<dd> |
| 125 |
Display the format of the output file. |
| 126 |
|
| 127 |
<dt><b>-depth=</b><i>N</i> |
| 128 |
<dd> |
| 129 |
Produce a file of depth <i>N</i>, where <i>N</i> must be either 1, 2, |
| 130 |
4, 8, or 16. Because the default Palm 8-bit colormap is not |
| 131 |
grayscale, if the input is a grayscale or monochrome image, the |
| 132 |
output will never be more than 4 bits deep, regardless of the |
| 133 |
specified depth. Note that 8-bit color works only in PalmOS 3.5 (and |
| 134 |
higher), and 16-bit direct color works only in PalmOS 4.0 (and |
| 135 |
higher). However, the 16-bit direct color format is also compatible |
| 136 |
with the various PalmOS 3.x versions used in the Handspring Visor, so |
| 137 |
these images may also work in that device. |
| 138 |
|
| 139 |
<dt><b>-maxdepth=</b><i>N</i> |
| 140 |
<dd> |
| 141 |
Produce a file of minimal depth, but in any case less than <i>N</i> |
| 142 |
bits wide. If you specify 16-bit, the output will always be 16-bit |
| 143 |
direct color. |
| 144 |
|
| 145 |
<dt><b>-offset</b> |
| 146 |
<dd> |
| 147 |
Set the <b>nextDepthOffset</b> field in the palm file header to indicate |
| 148 |
the end of the file (and pad the end of the file to 4 bytes, since |
| 149 |
<b>nextDepthOffset</b> can point only to 4 byte boundaries). |
| 150 |
|
| 151 |
<p>A palm image file can contain multiple renditions of the same image, |
| 152 |
with different color depths, so a viewer can choose one appropriate for |
| 153 |
the display. The <b>nextDepthOffset</b> field tells where in the stream |
| 154 |
the next rendition begins. |
| 155 |
|
| 156 |
<p><b>pnmtopalm</b> creates a file that contains only one image, but |
| 157 |
you can separately concatenate multiple one-image files to create a |
| 158 |
multi-image file. If you do that, you'll need to use <b>-offset</b> |
| 159 |
so that the resulting concatenation is a correct stream. |
| 160 |
|
| 161 |
<p>By default (if you don't specify <b>-offset</b>), <b>pnmtopalm</b> |
| 162 |
generates a <b>nextDepthOffset</b> field that says there is no following |
| 163 |
image (and does not add any padding after the image). |
| 164 |
|
| 165 |
<p>Version 3 Palm Bitmaps actually have a <b>nextBitmapOffset</b> |
| 166 |
field instead of the <b>nextDepthOffset</b>. The foregoing applies to |
| 167 |
whichever is relevant. |
| 168 |
|
| 169 |
<p>The <b>-offset</b> option was new in Netpbm 10.26 (January 2005). |
| 170 |
Before that, <b>pnmtopalm</b> always set the <b>nextDepthOffset</b> |
| 171 |
field to "none." |
| 172 |
|
| 173 |
<p>Before Netpbm 10.27 (March 2005), you cannot use <b>-offset</b> if |
| 174 |
you create a compressed raster (because <b>pnmtopalm</b> isn't smart |
| 175 |
enough to be able to know the size of the image at the time it writes |
| 176 |
the header). You also cannot use it with 16 bit color depth or with |
| 177 |
the <b>-colormap</b> option, for much the same reason. |
| 178 |
|
| 179 |
<dt><b>-withdummy</b> |
| 180 |
<dd> |
| 181 |
This option tells <b>pnmtopalm</b> to put in the stream, after |
| 182 |
the image, a dummy image header to introduce subsequent high density |
| 183 |
images. |
| 184 |
|
| 185 |
<p>This dummy image header is a special sequence specified in Palm Bitmap |
| 186 |
specifications. It looks to an older Palm Bitmap interpreter like an invalid |
| 187 |
image header, so such an interpreter will stop reading the stream |
| 188 |
there. But a new Palm Bitmap interpreter recognizes it for what it is (just |
| 189 |
something to choke an old interpreter) and skips over it. Presumably, |
| 190 |
you will add to the stream after this high density images which would |
| 191 |
confuse an older interpreter. |
| 192 |
|
| 193 |
<p>If you specify <b>-withdummy</b>, you must also specify <b>-offset</b>, |
| 194 |
since it doesn't make any sense otherwise. |
| 195 |
|
| 196 |
<p><b>-withdummy</b> was new in Netpbm 10.27 (March 2005). |
| 197 |
|
| 198 |
<dt><b>-colormap</b> |
| 199 |
<dd> |
| 200 |
Build a custom colormap and include it in the output file. This is |
| 201 |
not recommended by Palm, for efficiency reasons. Otherwise, <b>pnmtopalm</b> |
| 202 |
uses the default Palm colormap for color output. |
| 203 |
|
| 204 |
<dt><b>-transparent=</b><i>colorspec</i> |
| 205 |
|
| 206 |
<dd> |
| 207 |
Marks <em>one</em> particular color as fully transparent. |
| 208 |
|
| 209 |
<p><i>colorspec</i> is as described for the |
| 210 |
<a href="libnetpbm_image.html#colorname">argument of the <b>pnm_parsecolor()</b> |
| 211 |
library routine</a>. |
| 212 |
|
| 213 |
<p>Transparency works only on Palm OS 3.5 and higher. |
| 214 |
|
| 215 |
<dt><b>-scanline_compression</b> |
| 216 |
<dd> |
| 217 |
Specifies that the output Palm bitmap will use the Palm scanline |
| 218 |
compression scheme. Scanline compression works only in Palm OS 2.0 |
| 219 |
and higher. |
| 220 |
|
| 221 |
<dt><b>-rle_compression</b> |
| 222 |
<dd> |
| 223 |
Specifies that the output Palm bitmap will use the Palm RLE |
| 224 |
compression scheme. RLE compression works only with Palm OS 3.5 and |
| 225 |
higher. |
| 226 |
|
| 227 |
<dt><b>-packbits_compression</b> |
| 228 |
<dd> |
| 229 |
Specifies that the output Palm bitmap will use the Palm packbits |
| 230 |
compression scheme. Packbits compression works only with Palm OS 4.0 and |
| 231 |
higher. |
| 232 |
|
| 233 |
<p>This option was new in Netpbm 10.27 (March 2005). |
| 234 |
|
| 235 |
<dt><b>-density</b>=<i>N</i> |
| 236 |
<dd> |
| 237 |
This specifies the Palm Bitmap density. The density is a number that |
| 238 |
is proportional to the resolution the image should have when displayed. |
| 239 |
The proportionality factor is up to whatever is doing the displaying, |
| 240 |
but it's helpful to think of these numbers as being pixels per inch. |
| 241 |
The allowable values are: |
| 242 |
|
| 243 |
<ul> |
| 244 |
<li>72 |
| 245 |
<li>108 |
| 246 |
<li>144 |
| 247 |
<li>216 |
| 248 |
<li>288 |
| 249 |
</ul> |
| 250 |
|
| 251 |
<p>This option was new in Netpbm 10.27 (March 2005). Earlier Netpbm |
| 252 |
could not generate Version 3 Palm Bitmaps, so there was no such thing |
| 253 |
as density. |
| 254 |
|
| 255 |
</dl> |
| 256 |
|
| 257 |
<h2 id="seealso">SEE ALSO</h2> |
| 258 |
|
| 259 |
<b><a href="palmtopnm.html">palmtopnm</a></b>, |
| 260 |
<b><a href="pdbimgtopam.html">pdbimgtopam</a></b>, |
| 261 |
<b><a href="pnmquant.html">pnmquant</a></b>, |
| 262 |
<b><a href="pnmremap.html">pnmremap</a></b>, |
| 263 |
<a href="pnm.html">pnm</a> |
| 264 |
|
| 265 |
<h2 id="notes">NOTES</h2> |
| 266 |
|
| 267 |
<p>Palm Bitmaps may contains multiple renditions of the same bitmap, |
| 268 |
in different depths. To construct an N-multiple-rendition Palm Bitmap |
| 269 |
with <b>pnmtopalm</b>, first construct renditions 1 through N-1 using |
| 270 |
the <b>-offset</b> option, then construct the Nth image without the |
| 271 |
<b>-offset</b> option. Then concatenate the individual renditions |
| 272 |
together in a single file using <b>cat</b>. |
| 273 |
|
| 274 |
<p>If you will include both high density and low density renditions, |
| 275 |
put the high density images last and when you create the last of the |
| 276 |
low density images, use the <b>-withdummy</b> option. |
| 277 |
|
| 278 |
<p>If you specify the Palm packbits compression scheme for a 16-bit direct |
| 279 |
color bitmap, this program generates an invalid bitmap. |
| 280 |
|
| 281 |
|
| 282 |
<h2 id="authors">AUTHORS</h2> |
| 283 |
|
| 284 |
This program was originally written as ppmtoTbmp.c, by Ian Goldberg |
| 285 |
and George Caswell. It was completely re-written by Bill Janssen to |
| 286 |
add color, compression, and transparency function. |
| 287 |
<br> |
| 288 |
|
| 289 |
Copyright 1995-2001 by Ian Goldberg, George Caswell, and Bill Janssen. |
| 290 |
|
| 291 |
<hr> |
| 292 |
<h2 id="index">Table Of Contents</h2> |
| 293 |
<ul> |
| 294 |
<li><a href="#synopsis">SYNOPSIS</a> |
| 295 |
<li><a href="#description">DESCRIPTION</a> |
| 296 |
<ul> |
| 297 |
<li><a href="#version">Palm Bitmap Version</a> |
| 298 |
</ul> |
| 299 |
<li><a href="#options">OPTIONS</a> |
| 300 |
<li><a href="#seealso">SEE ALSO</a> |
| 301 |
<li><a href="#notes">NOTES</a> |
| 302 |
<li><a href="#authors">AUTHORS</a> |
| 303 |
</ul> |
| 304 |
</body> |
| 305 |
</html> |