1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
<html><head><title>Ppmtobmp User Manual</title>
</head><body>
<h1>ppmtobmp</h1>
Updated: 20 December 2018
<br>
<a href="#index">Table Of Contents</a>
<h2>NAME</h2>
ppmtobmp - convert a PPM image into a BMP file
<h2 id="synopsis">SYNOPSIS</h2>
<b>ppmtobmp</b>
[<b>-windows</b>]
[<b>-os2</b>]
[<b>-bpp=</b><i>bits_per_pixel</i>]
[<b>-mapfile=</b><i>filename</i>]
[<i>ppmfile</i>]
<p>Minimum unique abbreviation of option is acceptable. You may use double
hyphens instead of single hyphen to denote options. You may use white
space in place of the equals sign to separate an option name from its value.
<h2 id="description">DESCRIPTION</h2>
<p>This program is part of <a href="index.html">Netpbm</a>.
<p><b>ppmtobmp</b> reads a PPM image as input and produces a Microsoft
Windows or OS/2 BMP file as output.
<h2 id="options">OPTIONS</h2>
<p>In addition to the options common to all programs based on libnetpbm
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
Common Options</a>), <b>ppmtobmp</b> recognizes the following
command line options:
<dl compact>
<dt><b>-windows</b>
<dd>Tells the program to produce a Microsoft Windows BMP file. (This
is the default.)
<dt><b>-os2</b>
<dd>Tells the program to produce an OS/2 BMP file. (Before August
2000, this was the default).
<dt><b>-bpp</b>
<dd>This tells how many bits per pixel you want the BMP file to
contain. Only 1, 4, 8, and 24 are possible. By default,
<b>ppmtobmp</b> chooses the smallest number with which it can
represent all the colors in the input image. If you specify a number
too small to represent all the colors in the input image,
<b>ppmtobmp</b> tells you and terminates. You can use <b>pnmquant</b>
or <b>ppmdither</b> to reduce the number of colors in the image.
<p>Before Netpbm 10.85 (December 2018), <b>ppmtobmp</b> ignores this option if
the input is PBM and produces a BMP with 1 bit per pixel. With these
versions, if you want more than that, use <b>pbmtopgm</b> to convert the PBM
to PGM first.
<dt><b>-mapfile=</b><i>filename</i>
<dd>This identifies a file to use as the BMP palette (aka
"colormap"). In one BMP subformat, the BMP stream contains
a palette of up to 256 colors, and represents the image raster as
indices into that palette. Normally, <b>ppmtobmp</b> takes care of
computing a suitable palette, but if you are going to dissect the BMP
output in some way, you may want certain values for the palette
indices. E.g. you might want red to be 13, where <b>ppmtobmp</b>
would (arbitrarily) choose 39. In that case, you can construct the
palette yourself and use this option to tell <b>ppmtobmp</b> to use
your palette.
<p>This option does <em>not</em> control what colors are in the
output. The colors in the output are exactly those in the input, and
the palette you supply must contain at least all the colors that are
in the input. You can use <b>pnmremap</b> to adjust your input image
so that it contains only colors from your palette.
<p>The palette file is a Netpbm format file with one pixel per
palette entry. Each pixel must have a distinct color (no repeats).
The order of the BMP palette <b>ppmtobmp</b> generates is the order
of the pixels in the palette file, going from top to bottom, left
to right.
<p>A BMP palette may have at most 256 colors, so the palette file
must have at most 256 pixels.
<p>You may find <b>pnmcolormap</b> useful in generating the palette
file. <b>pamseq</b> too.
<p>In the case of grayscale image, if you are processing the BMP image, it
may be convenient for you to have the actual gray values in the raster
part of the image rather than arbitrary indices into a palette. There is
no BMP format specifically for that, but you can achieve it by using a
palette in which each index is equal to the indexed gray value, and then
ignoring the palette when you process the BMP image.
<p>Here is an example of doing that:
<pre>
<kbd>
$ pamseq 1 255 > mapfile.pgm
$ ppmtobmp -mapfile=mapfile.pgm input.pgm > output.bmp
</kbd>
</pre>
<p>This option was new in Netpbm 10.45 (December 2008).
</dl>
<h2 id="notes">NOTES</h2>
<p>To get a faithful reproduction of the input image, the maxval of the
input image must be 255. If it is something else,
the colors in the BMP file may be slightly different from the colors
in the input.
<p>Windows icons are not BMP files. Use <b>ppmtowinicon</b> to
create those.
<h2 id="seealso">SEE ALSO</h2>
<b><a href="bmptoppm.html">bmptoppm</a></b>,
<b><a href="ppmtowinicon.html">ppmtowinicon</a></b>,
<b><a href="pnmquant.html">pnmquant</a></b>,
<b><a href="ppmdither.html">ppmdither</a></b>,
<b><a href="pnmremap.html">pnmremap</a></b>,
<b><a href="ppm.html">ppm</a></b>
<h2 id="author">AUTHOR</h2>
Copyright (C) 1992 by David W. Sanderson.
<hr>
<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#synopsis">SYNOPSIS</a>
<li><a href="#description">DESCRIPTION</a>
<li><a href="#options">OPTIONS</a>
<li><a href="#notes">NOTES</a>
<li><a href="#seealso">SEE ALSO</a>
<li><a href="#author">AUTHOR</a>
</ul>
</body>
</html>
|