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