1Ppmtoxpm User Manual(0) Ppmtoxpm User Manual(0)
2
3
4
6 ppmtoxpm - convert a PPM image to an X11 pixmap
7
8
10 ppmtoxpm [-name=xpmname] [-hexonly] [-rgb=rgb-textfile]
11 [-alphamask=pgmfile] [ppmfile]
12
13 Minimum unique abbreviation of option is acceptable. You may use dou‐
14 ble hyphens instead of single hyphen to denote options. You may use
15 white space in place of the equals sign to separate an option name from
16 its value.
17
18
20 This program is part of Netpbm(1).
21
22 ppmtoxpm reads a PPM image as input and produces X11 pixmap (version 3)
23 as output. This format can be loaded by the XPM library.
24
25 In the XPM output, colors may be identified by name, such as "Red", or
26 in hexadecimal, for example "#FF0000". In the hexadecimal format,
27 there may be from 1 through 4 hexadecimal digits per RGB component.
28
29 By default, ppmtoxpbm tries to find a name for each color in the image
30 in the system color dictionary ⟨libppm.html#rgb.txt⟩ , and if it finds
31 one, uses it. If it doesn't it uses hexadecimal. You can force ppm‐
32 toxpbm to use hexadecimal only with the -hexonly option. You can spec‐
33 ify a different color dictionary with the -rgb option.
34
35 When ppmtoxpm uses the hexadecimal format for identifying a color, it
36 uses the one that uses the least number of hexadecimal digits that it
37 takes to represent the maxval of the input PPM. E.g. if the maxval of
38 the input PPM is 100, ppmtoxpm uses 2 digits per component, as in
39 "#FF0000".
40
41 Some programs do not properly handle one-digit-per-component hexadeci‐
42 mal color specifiers. They see the wrong colors. To produce an XPM
43 that such a program can handle, make sure the maxval of the input PPM
44 is greater than 15, such as by running it through pamdepth 255.
45
46
47 Color Code Lengths - Image Size
48 In the XPM format, there is a palette ('color map') that assigns each
49 color in the image to a unique sequence of printable characters called
50 a color code, and a raster that identifies the color of each pixel of
51 the image with one of those color codes. The length of the color code
52 affects the size of the image stream.
53
54 All color codes in an image are the same length, and ppmtoxpm tries to
55 make it as short as possible. That length is, of course, determined by
56 the number of colors in the image. ppmtoxpm counts the colors in the
57 image, excluding those that will be transparent in the output due to
58 your alpha mask, and chooses a color code length accordingly. There
59 are 92 printable characters that can be used in a color code. There‐
60 fore, if you have 92 or fewer colors, your color codes will be one
61 character. If you have more than 92 but not more than 92 * 92, your
62 color codes will be two characters. And so on.
63
64 There's one exception to the above: If you specify an alpha mask (the
65 -alpha option, one unique color code represents 'transparent.' This is
66 true even if the alpha mask doesn't actually produce any transparent
67 pixels. So subtract one from the number of possible colors if you use
68 -alpha.
69
70
71
73 -name=xpmname
74 This option specifies the prefix string which is specified in
75 the resulting XPM output. If you don't use the -name otpion,
76 ppmtoxpm defaults to the filename (without extension) of the
77 ppmfile parameter. If you do not specify -name or ppmfile (i.e.
78 your input is from Standard Input), the prefix string defaults
79 to the string noname.
80
81
82 -hexonly
83 This option says never to put color names in the XPM file, but
84 rather to identify names by hexadecimal strings that explicitly
85 identify RGB component intensities. This means the reader of
86 the file need not have access to a suitable color dictionary to
87 interpret it.
88
89 This option was introduced in Netpbm 10.15 (April 2003). Before
90 that, it was the default, overridden by specifying -rgb.
91
92
93 -rgb=rgb-textfile
94 This option names the file in which the color dictionary you
95 want to use resides. By default, ppmtoxpm uses the system color
96 dictionary ⟨libppm.html#rgb.txt⟩ .
97
98 This option in meaningless when you specify -hexonly.
99
100 Before Netpbm 10.15 (April 2003), ppmtoxpm did not default to
101 the system color dictionary. If you didn't specify -rgb, ppm‐
102 toxpbm would use only hexadecimal color specifiers.
103
104
105 -alphamask=pgmfile
106 This option names a PGM file to use as an alpha (transparency)
107 mask. The file must contain an image the same dimensions as the
108 input image. ppmtoxpm marks as transparent any pixel whose
109 position in the alpha mask image is at most half white.
110
111 If you don't specify -alphamask, ppmtoxpm makes all pixels in
112 the output opaque.
113
114 ppmcolormask is one way to generate an alpha mask file. You
115 might also generate it by extracting transparency information
116 from an XPM file with the -alphaout option to xpmtoppm.
117
118 There are similar options on other Netpbm converters that con‐
119 vert from formats that include transparency information too.
120
121
122
124 ppmcolormask(1), xpmtoppm(1), pamdepth(1), ppm(1) XPM Manual by Arnaud
125 Le Hors lehors@mirsa.inria.fr
126
127
129 Copyright (C) 1990 by Mark W. Snitily.
130
131 Permission to use, copy, modify, and distribute this software and its
132 documentation for any purpose and without fee is hereby granted, pro‐
133 vided that the above copyright notice appear in all copies and that
134 both that copyright notice and this permission notice appear in sup‐
135 porting documentation. This software is provided 'as is' without
136 express or implied warranty.
137
138 This tool was developed for Schlumberger Technologies, ATE Division,
139 and with their permission is being made available to the public with
140 the above copyright notice and permission notice.
141
142 Upgraded to XPM2 by Paul Breslaw, Mecasoft SA, Zurich, Switzerland
143 (paul@mecazh.uu.ch), November 8, 1990.
144
145 Upgraded to XPM version 3 by Arnaud Le Hors(lehors@mirsa.inria.fr),
146 April 9, 1991.
147
148
149
150netpbm documentation Feb 22 2003 Ppmtoxpm User Manual(0)