summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-40/man1/ppmtoxpm.1
blob: 45df0cd2f796303067ead7a8659b5b3e84cba969 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it!  If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "Ppmtoxpm User Manual" 0 "22 February 2003" "netpbm documentation"

.SH NAME
ppmtoxpm - convert a PPM image to an X11 pixmap

.UN synopsis
.SH SYNOPSIS

\fBppmtoxpm \fP
[\fB-name=\fP\fIxpmname\fP]
[\fB-hexonly\fP]
[\fB-rgb=\fP\fIrgb-textfile\fP]
[\fB-alphamask=\fP\fIpgmfile\fP]
[\fIppmfile\fP]
.PP
Minimum unique abbreviation of option is acceptable.  You may use double
hyphens instead of single hyphen to denote options.  You may use white
space in place of the equals sign to separate an option name from its value.

.UN description
.SH DESCRIPTION
.PP
This program is part of
.BR "Netpbm" (1)\c
\&.
.PP
\fBppmtoxpm\fP reads a PPM image as input and produces X11 pixmap
(version 3) as output.  This format can be loaded by the XPM library.
.PP
In the XPM output, colors may be identified by name, such as "Red", or
in hexadecimal, for example "#FF0000".  In the hexadecimal format, there
may be from 1 through 4 hexadecimal digits per RGB component.
.PP
By default, \fBppmtoxpbm\fP tries to find a name for each color in
the image in the 
.UR libppm.html#dictionary
system color dictionary
.UE
\&, and if it finds one, uses it.  If it doesn't it uses
hexadecimal.  You can force \fBppmtoxpbm\fP to use hexadecimal only
with the \fB-hexonly\fP option.  You can specify a different color
dictionary with the \fB-rgb\fP option.
.PP
When \fBppmtoxpm\fP uses the hexadecimal format for identifying a color,
it uses the one that uses the least number of hexadecimal digits that it
takes to represent the maxval of the input PPM.  E.g. if the maxval of the
input PPM is 100, \fBppmtoxpm\fP uses 2 digits per component, as in
"#FF0000".
.PP
Some programs do not properly handle one-digit-per-component
hexadecimal color specifiers.  They see the wrong colors.  To produce
an XPM that such a program can handle, make sure the maxval of the input PPM
is greater than 15, such as by running it through \fBpamdepth 255\fP.

.SS Color Code Lengths - Image Size
.PP
In the XPM format, there is a palette ("color map") that
assigns each color in the image to a unique sequence of printable
characters called a color code, and a raster that identifies the color
of each pixel of the image with one of those color codes.  The length
of the color code affects the size of the image stream.  
.PP
All color codes in an image are the same length, and
\fBppmtoxpm\fP tries to make it as short as possible.  That length
is, of course, determined by the number of colors in the image.
\fBppmtoxpm\fP counts the colors in the image, excluding those that will be
transparent in the output because of your transparency mask, and chooses a
color code length accordingly.  There are 92 printable characters that can be
used in a color code.  Therefore, if you have 92 or fewer colors, your color
codes will be one character.  If you have more than 92 but not more than 92 *
92, your color codes will be two characters.  And so on.
.PP
There's one exception to the above: If you specify a transparency mask
(the \fB-alpha\fP option, one unique color code represents
"transparent."  This is true even if the transparency mask doesn't 
actually produce any transparent pixels.  So subtract one from the number
of possible colors if you use \fB-alpha\fP.


.UN options
.SH OPTIONS
.PP
In addition to the options common to all programs based on libnetpbm
(most notably \fB-quiet\fP, see 
.UR index.html#commonoptions
 Common Options
.UE
\&), \fBppmtoxpm\fP recognizes the following
command line options:


.TP
\fB-name=\fP\fIxpmname\fP
This option specifies the prefix string which is specified in the
resulting XPM output.  If you don't use the \fB-name\fP otpion,
\fBppmtoxpm\fP defaults to the filename (without extension) of the
\fIppmfile\fP parameter.  If you do not specify \fB-name\fP or
\fIppmfile\fP (i.e. your input is from Standard Input), the prefix
string defaults to the string \fBnoname\fP.

.TP
\fB-hexonly\fP
This option says never to put color names in the XPM file, but rather
to identify names by hexadecimal strings that explicitly identify RGB
component intensities.  This means the reader of the file need not have
access to a suitable color dictionary to interpret it.
.sp
This option was introduced in Netpbm 10.15 (April 2003).  Before that,
it was the default, overridden by specifying \fB-rgb\fP.

.TP
\fB-rgb=\fP\fIrgb-textfile\fP
This option names the file in which the color dictionary you want
to use resides.  By default, \fBppmtoxpm\fP uses the 
.UR libppm.html#dictionary
system color dictionary
.UE
\&, and if it cannot
open that file, uses hexadecimal color specifiers.
.sp
This option in meaningless when you specify \fB-hexonly\fP.
.sp
Before Netpbm 10.15 (April 2003), \fBppmtoxpm\fP did not default
to the system color dictionary.  If you didn't specify \fB-rgb\fP,
\fBppmtoxpbm\fP would use only hexadecimal color specifiers.

.TP
\fB-alphamask=\fP\fIpgmfile\fP
 This option names a PGM file to use as a transparency (alpha)
mask.  The file must contain an image the same dimensions as the input
image.  \fBppmtoxpm\fP marks as transparent any pixel whose position
in the transparency mask image is at most half white.
.sp
If you don't specify \fB-alphamask\fP, \fBppmtoxpm\fP makes all
pixels in the output opaque.
.sp
\fBppmcolormask\fP is one way to generate a transparency mask file.  You
might also generate it by extracting transparency information from an
XPM file with the \fB-alphaout\fP option to \fBxpmtoppm\fP.
.sp
There are similar options on other Netpbm converters that convert from
formats that include transparency information too.


.UN seealso
.SH SEE ALSO
.BR "ppmcolormask" (1)\c
\&,
.BR "xpmtoppm" (1)\c
\&,
.BR "pamdepth" (1)\c
\&,
.BR "ppm" (1)\c
\&
XPM Manual by Arnaud Le Hors \fIlehors@mirsa.inria.fr\fP

.UN author
.SH AUTHOR
.PP
Copyright (C) 1990 by Mark W. Snitily.
.PP
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.  This software is provided "as is" without express or
implied warranty.
.PP
This tool was developed for Schlumberger Technologies, ATE Division, and
with their permission is being made available to the public with the above
copyright notice and permission notice.
.PP
Upgraded to XPM2 by Paul Breslaw, Mecasoft SA, Zurich, Switzerland (\fIpaul@mecazh.uu.ch\fP), November 8,
1990.
.PP
Upgraded to XPM version 3 by Arnaud Le Hors(\fIlehors@mirsa.inria.fr\fP), April
9, 1991.
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source.  The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/ppmtoxpm.html
.PP