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#dictionary⟩ , and if it
31 finds one, uses it. If it doesn't it uses hexadecimal. You can force
32 ppmtoxpbm to use hexadecimal only with the -hexonly option. You can
33 specify 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 because
58 of your transparency mask, and chooses a color code length accordingly.
59 There are 92 printable characters that can be used in a color code.
60 Therefore, 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 a transparency mask
65 (the -alpha option, one unique color code represents "transparent."
66 This is true even if the transparency mask doesn't actually produce any
67 transparent pixels. So subtract one from the number of possible colors
68 if you use -alpha.
69
70
71
73 In addition to the options common to all programs based on libnetpbm
74 (most notably -quiet, see
75 Common Options ⟨index.html#commonoptions⟩ ), ppmtoxpm recognizes the
76 following command line options:
77
78
79
80 -name=xpmname
81 This option specifies the prefix string which is specified in
82 the resulting XPM output. If you don't use the -name otpion,
83 ppmtoxpm defaults to the filename (without extension) of the
84 ppmfile parameter. If you do not specify -name or ppmfile (i.e.
85 your input is from Standard Input), the prefix string defaults
86 to the string noname.
87
88
89 -hexonly
90 This option says never to put color names in the XPM file, but
91 rather to identify names by hexadecimal strings that explicitly
92 identify RGB component intensities. This means the reader of
93 the file need not have access to a suitable color dictionary to
94 interpret it.
95
96 This option was introduced in Netpbm 10.15 (April 2003). Before
97 that, it was the default, overridden by specifying -rgb.
98
99
100 -rgb=rgb-textfile
101 This option names the file in which the color dictionary you
102 want to use resides. By default, ppmtoxpm uses the system color
103 dictionary ⟨libppm.html#dictionary⟩ , and if it cannot open that
104 file, uses hexadecimal color specifiers.
105
106 This option in meaningless when you specify -hexonly.
107
108 Before Netpbm 10.15 (April 2003), ppmtoxpm did not default to
109 the system color dictionary. If you didn't specify -rgb, ppm‐
110 toxpbm would use only hexadecimal color specifiers.
111
112
113 -alphamask=pgmfile
114 This option names a PGM file to use as a transparency (alpha)
115 mask. The file must contain an image the same dimensions as the
116 input image. ppmtoxpm marks as transparent any pixel whose
117 position in the transparency mask image is at most half white.
118
119 If you don't specify -alphamask, ppmtoxpm makes all pixels in
120 the output opaque.
121
122 ppmcolormask is one way to generate a transparency mask file.
123 You might also generate it by extracting transparency informa‐
124 tion from an XPM file with the -alphaout option to xpmtoppm.
125
126 There are similar options on other Netpbm converters that con‐
127 vert from formats that include transparency information too.
128
129
130
132 ppmcolormask(1), xpmtoppm(1), pamdepth(1), ppm(1) XPM Manual by Arnaud
133 Le Hors lehors@mirsa.inria.fr
134
135
137 Copyright (C) 1990 by Mark W. Snitily.
138
139 Permission to use, copy, modify, and distribute this software and its
140 documentation for any purpose and without fee is hereby granted, pro‐
141 vided that the above copyright notice appear in all copies and that
142 both that copyright notice and this permission notice appear in sup‐
143 porting documentation. This software is provided "as is" without
144 express or implied warranty.
145
146 This tool was developed for Schlumberger Technologies, ATE Division,
147 and with their permission is being made available to the public with
148 the above copyright notice and permission notice.
149
150 Upgraded to XPM2 by Paul Breslaw, Mecasoft SA, Zurich, Switzerland
151 (paul@mecazh.uu.ch), November 8, 1990.
152
153 Upgraded to XPM version 3 by Arnaud Le Hors(lehors@mirsa.inria.fr),
154 April 9, 1991.
155
157 This manual page was generated by the Netpbm tool 'makeman' from HTML
158 source. The master documentation is at
159
160 http://netpbm.sourceforge.net/doc/ppmtoxpm.html
161
162netpbm documentation 22 February 2003 Ppmtoxpm User Manual(0)