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 -windows
38 Tells the program to produce a Microsoft Windows BMP file.
39 (This is the default.)
40
41
42 -os2 Tells the program to produce an OS/2 BMP file. (Before August
43 2000, this was the default).
44
45
46 -bpp This tells how many bits per pixel you want the BMP file to con‐
47 tain. Only 1, 4, 8, and 24 are possible. By default, ppmtobmp
48 chooses the smallest number with which it can represent all the
49 colors in the input image. If you specify a number too small to
50 represent all the colors in the input image, ppmtobmp tells you
51 and terminates. You can use pnmquant or ppmdither to reduce the
52 number of colors in the image.
53
54 Before Netpbm 10.85 (December 2018), ppmtobmp ignores this
55 option if the input is PBM and produces a BMP with 1 bit per
56 pixel. With these versions, if you want more than that, use
57 pbmtopgm to convert the PBM to PGM first.
58
59
60 -mapfile=filename
61 This identifies a file to use as the BMP palette (aka "col‐
62 ormap"). In one BMP subformat, the BMP stream contains a pal‐
63 ette of up to 256 colors, and represents the image raster as
64 indices into that palette. Normally, ppmtobmp takes care of
65 computing a suitable palette, but if you are going to dissect
66 the BMP output in some way, you may want certain values for the
67 palette indices. E.g. you might want red to be 13, where ppm‐
68 tobmp would (arbitrarily) choose 39. In that case, you can con‐
69 struct the palette yourself and use this option to tell ppmtobmp
70 to use your palette.
71
72 This option does not control what colors are in the output. The
73 colors in the output are exactly those in the input, and the
74 palette you supply must contain at least all the colors that are
75 in the input. You can use pnmremap to adjust your input image
76 so that it contains only colors from your palette.
77
78 The palette file is a Netpbm format file with one pixel per pal‐
79 ette entry. Each pixel must have a distinct color (no repeats).
80 The order of the BMP palette ppmtobmp generates is the order of
81 the pixels in the palette file, going from top to bottom, left
82 to right.
83
84 A BMP palette may have at most 256 colors, so the palette file
85 must have at most 256 pixels.
86
87 You may find pnmcolormap useful in generating the palette file.
88 pamseq too.
89
90 In the case of grayscale image, if you are processing the BMP
91 image, it
92 may be convenient for you to have the actual gray values in
93 the raster
94 part of the image rather than arbitrary indices into a pal‐
95 ette. There is
96 no BMP format specifically for that, but you can achieve it by
97 using a
98 palette in which each index is equal to the indexed gray
99 value, and then
100 ignoring the palette when you process the BMP image.
101
102 Here is an example of doing that:
103
104
105 $ pamseq 1 255 >mapfile.pgm
106
107 $ ppmtobmp -mapfile=mapfile.pgm input.pgm >output.bmp
108
109
110 This option was new in Netpbm 10.45 (December 2008).
111
112
113
114
115
117 To get a faithful reproduction of the input image, the maxval of the
118 input image must be 255. If it is something else, the colors in the
119 BMP file may be slightly different from the colors in the input.
120
121 Windows icons are not BMP files. Use ppmtowinicon to create those.
122
123
125 bmptoppm(1), ppmtowinicon(1), pnmquant(1), ppmdither(1), pnmremap(1),
126 ppm(1)
127
128
130 Copyright (C) 1992 by David W. Sanderson.
131
133 This manual page was generated by the Netpbm tool 'makeman' from HTML
134 source. The master documentation is at
135
136 http://netpbm.sourceforge.net/doc/ppmtobmp.html
137
138netpbm documentation 20 December 2018 Ppmtobmp User Manual(0)