1Ppmtobmp User Manual(0) Ppmtobmp User Manual(0)
2
3
4
6 ppmtobmp - convert a PPM image into a BMP file
7
8
10 ppmtobmp
11
12 [-windows]
13
14 [-os2]
15
16 [-bpp=bits_per_pixel]
17
18 [-mapfile=filename]
19
20 [ppmfile]
21
22 Minimum unique abbreviation of option is acceptable. You may use dou‐
23 ble hyphens instead of single hyphen to denote options. You may use
24 white space in place of the equals sign to separate an option name from
25 its value.
26
27
28
30 This program is part of Netpbm(1).
31
32 ppmtobmp reads a PPM image as input and produces a Microsoft Windows or
33 OS/2 BMP file as output.
34
35
37 In addition to the options common to all programs based on libnetpbm
38 (most notably -quiet, see
39 Common Options ⟨index.html#commonoptions⟩ ), ppmtobmp recognizes the
40 following command line options:
41
42
43
44 -windows
45 Tells the program to produce a Microsoft Windows BMP file.
46 (This is the default.)
47
48
49 -os2 Tells the program to produce an OS/2 BMP file. (Before August
50 2000, this was the default).
51
52
53 -bpp This tells how many bits per pixel you want the BMP file to con‐
54 tain. Only 1, 4, 8, and 24 are possible. By default, ppmtobmp
55 chooses the smallest number with which it can represent all the
56 colors in the input image. If you specify a number too small to
57 represent all the colors in the input image, ppmtobmp tells you
58 and terminates. You can use pnmquant or ppmdither to reduce the
59 number of colors in the image.
60
61 Before Netpbm 10.85 (December 2018), ppmtobmp ignores this op‐
62 tion if the input is PBM and produces a BMP with 1 bit per
63 pixel. With these versions, if you want more than that, use
64 pbmtopgm to convert the PBM to PGM first.
65
66
67 -mapfile=filename
68 This identifies a file to use as the BMP palette (aka "col‐
69 ormap"). In one BMP subformat, the BMP stream contains a pal‐
70 ette of up to 256 colors, and represents the image raster as in‐
71 dices into that palette. Normally, ppmtobmp takes care of com‐
72 puting a suitable palette, but if you are going to dissect the
73 BMP output in some way, you may want certain values for the pal‐
74 ette indices. E.g. you might want red to be 13, where ppmtobmp
75 would (arbitrarily) choose 39. In that case, you can construct
76 the palette yourself and use this option to tell ppmtobmp to use
77 your palette.
78
79 This option does not control what colors are in the output. The
80 colors in the output are exactly those in the input, and the
81 palette you supply must contain at least all the colors that are
82 in the input. You can use pnmremap to adjust your input image
83 so that it contains only colors from your palette.
84
85 The palette file is a Netpbm format file with one pixel per pal‐
86 ette entry. Each pixel must have a distinct color (no repeats).
87 The order of the BMP palette ppmtobmp generates is the order of
88 the pixels in the palette file, going from top to bottom, left
89 to right.
90
91 A BMP palette may have at most 256 colors, so the palette file
92 must have at most 256 pixels.
93
94 You may find pnmcolormap useful in generating the palette file.
95 pamseq too.
96
97 In the case of grayscale image, if you are processing the BMP
98 image, it
99 may be convenient for you to have the actual gray values in
100 the raster
101 part of the image rather than arbitrary indices into a pal‐
102 ette. There is
103 no BMP format specifically for that, but you can achieve it by
104 using a
105 palette in which each index is equal to the indexed gray
106 value, and then
107 ignoring the palette when you process the BMP image.
108
109 Here is an example of doing that:
110
111
112 $ pamseq 1 255 > mapfile.pgm
113
114 $ ppmtobmp -mapfile=mapfile.pgm input.pgm > output.bmp
115
116
117
118 This option was new in Netpbm 10.45 (December 2008).
119
120
121
122
123
125 To get a faithful reproduction of the input image, the maxval of the
126 input image must be 255. If it is something else, the colors in the
127 BMP file may be slightly different from the colors in the input.
128
129 Windows icons are not BMP files. Use ppmtowinicon to create those.
130
131
133 bmptoppm(1), ppmtowinicon(1), pnmquant(1), ppmdither(1), pnmremap(1),
134 ppm(1)
135
136
138 Copyright (C) 1992 by David W. Sanderson.
139
141 This manual page was generated by the Netpbm tool 'makeman' from HTML
142 source. The master documentation is at
143
144 http://netpbm.sourceforge.net/doc/ppmtobmp.html
145
146netpbm documentation 20 December 2018 Ppmtobmp User Manual(0)