Blame userguide/ppmtoxpm.html

Packit 78deda
Packit 78deda
<HTML><HEAD><TITLE>Ppmtoxpm User Manual</TITLE></HEAD>
Packit 78deda
<BODY>
Packit 78deda

ppmtoxpm

Packit 78deda
Updated: Feb 22 2003
Packit 78deda

Packit 78deda
Table Of Contents
Packit 78deda
Packit 78deda

NAME

Packit 78deda
ppmtoxpm - convert a PPM image to an X11 pixmap
Packit 78deda
Packit 78deda

SYNOPSIS

Packit 78deda
Packit 78deda
ppmtoxpm 
Packit 78deda
[-name=xpmname]
Packit 78deda
[-hexonly]
Packit 78deda
[-rgb=rgb-textfile]
Packit 78deda
[-alphamask=pgmfile]
Packit 78deda
[ppmfile]
Packit 78deda
Packit 78deda

Minimum unique abbreviation of option is acceptable. You may use double

Packit 78deda
hyphens instead of single hyphen to denote options.  You may use white
Packit 78deda
space in place of the equals sign to separate an option name from its value.
Packit 78deda
Packit 78deda

DESCRIPTION

Packit 78deda
Packit 78deda

This program is part of Netpbm.

Packit 78deda
Packit 78deda

ppmtoxpm reads a PPM image as input and produces X11 pixmap

Packit 78deda
(version 3) as output.  This format can be loaded by the XPM library.
Packit 78deda
Packit 78deda

In the XPM output, colors may be identified by name, such as "Red", or

Packit 78deda
in hexadecimal, for example "#FF0000".  In the hexadecimal format, there
Packit 78deda
may be from 1 through 4 hexadecimal digits per RGB component.
Packit 78deda
Packit 78deda

By default, ppmtoxpbm tries to find a name for each color in

Packit 78deda
the image in the system color
Packit 78deda
dictionary, and if it finds one, uses it.  If it doesn't it uses
Packit 78deda
hexadecimal.  You can force ppmtoxpbm to use hexadecimal only
Packit 78deda
with the -hexonly option.  You can specify a different color
Packit 78deda
dictionary with the -rgb option.
Packit 78deda
Packit 78deda

When ppmtoxpm uses the hexadecimal format for identifying a color,

Packit 78deda
it uses the one that uses the least number of hexadecimal digits that it
Packit 78deda
takes to represent the maxval of the input PPM.  E.g. if the maxval of the
Packit 78deda
input PPM is 100, ppmtoxpm uses 2 digits per component, as in
Packit 78deda
"#FF0000".
Packit 78deda
Packit 78deda

Some programs do not properly handle one-digit-per-component

Packit 78deda
hexadecimal color specifiers.  They see the wrong colors.  To produce
Packit 78deda
an XPM that such a program can handle, make sure the maxval of the input PPM
Packit 78deda
is greater than 15, such as by running it through pamdepth 255.
Packit 78deda
Packit 78deda

Color Code Lengths - Image Size

Packit 78deda
Packit 78deda

In the XPM format, there is a palette ("color map") that

Packit 78deda
assigns each color in the image to a unique sequence of printable
Packit 78deda
characters called a color code, and a raster that identifies the color
Packit 78deda
of each pixel of the image with one of those color codes.  The length
Packit 78deda
of the color code affects the size of the image stream.  
Packit 78deda
Packit 78deda

All color codes in an image are the same length, and

Packit 78deda
ppmtoxpm tries to make it as short as possible.  That length
Packit 78deda
is, of course, determined by the number of colors in the image.
Packit 78deda
ppmtoxpm counts the colors in the image, excluding those that will be
Packit 78deda
transparent in the output because of your transparency mask, and chooses a
Packit 78deda
color code length accordingly.  There are 92 printable characters that can be
Packit 78deda
used in a color code.  Therefore, if you have 92 or fewer colors, your color
Packit 78deda
codes will be one character.  If you have more than 92 but not more than 92 *
Packit 78deda
92, your color codes will be two characters.  And so on.
Packit 78deda
Packit 78deda

There's one exception to the above: If you specify a transparency mask

Packit 78deda
(the -alpha option, one unique color code represents
Packit 78deda
"transparent."  This is true even if the transparency mask doesn't 
Packit 78deda
actually produce any transparent pixels.  So subtract one from the number
Packit 78deda
of possible colors if you use -alpha.
Packit 78deda
Packit 78deda
Packit 78deda

OPTIONS

Packit 78deda
Packit 78deda
Packit 78deda
-name=xpmname
Packit 78deda
Packit 78deda
This option specifies the prefix string which is specified in the
Packit 78deda
resulting XPM output.  If you don't use the -name otpion,
Packit 78deda
ppmtoxpm defaults to the filename (without extension) of the
Packit 78deda
ppmfile parameter.  If you do not specify -name or
Packit 78deda
ppmfile (i.e. your input is from Standard Input), the prefix
Packit 78deda
string defaults to the string noname.
Packit 78deda
Packit 78deda
-hexonly
Packit 78deda
Packit 78deda
This option says never to put color names in the XPM file, but rather
Packit 78deda
to identify names by hexadecimal strings that explicitly identify RGB
Packit 78deda
component intensities.  This means the reader of the file need not have
Packit 78deda
access to a suitable color dictionary to interpret it.
Packit 78deda
Packit 78deda

This option was introduced in Netpbm 10.15 (April 2003). Before that,

Packit 78deda
it was the default, overridden by specifying -rgb.
Packit 78deda
Packit 78deda
-rgb=rgb-textfile
Packit 78deda
Packit 78deda
This option names the file in which the color dictionary you want
Packit 78deda
to use resides.  By default, ppmtoxpm uses the 
Packit 78deda
href="libppm.html#rgb.txt">system color dictionary, and if it cannot
Packit 78deda
open that file, uses hexadecimal color specifiers.
Packit 78deda
Packit 78deda

This option in meaningless when you specify -hexonly.

Packit 78deda
Packit 78deda

Before Netpbm 10.15 (April 2003), ppmtoxpm did not default

Packit 78deda
to the system color dictionary.  If you didn't specify -rgb,
Packit 78deda
ppmtoxpbm would use only hexadecimal color specifiers.
Packit 78deda
Packit 78deda
-alphamask=pgmfile
Packit 78deda
Packit 78deda
This option names a PGM file to use as a transparency (alpha)
Packit 78deda
mask.  The file must contain an image the same dimensions as the input
Packit 78deda
image.  ppmtoxpm marks as transparent any pixel whose position
Packit 78deda
in the transparency mask image is at most half white.  
Packit 78deda
Packit 78deda

If you don't specify -alphamask, ppmtoxpm makes all

Packit 78deda
pixels in the output opaque.  
Packit 78deda
Packit 78deda

ppmcolormask is one way to generate a transparency mask file. You

Packit 78deda
might also generate it by extracting transparency information from an
Packit 78deda
XPM file with the -alphaout option to xpmtoppm.
Packit 78deda
Packit 78deda

There are similar options on other Netpbm converters that convert from

Packit 78deda
formats that include transparency information too.
Packit 78deda
Packit 78deda
Packit 78deda

SEE ALSO

Packit 78deda
Packit 78deda
ppmcolormask,
Packit 78deda
xpmtoppm,
Packit 78deda
pamdepth,
Packit 78deda
ppm
Packit 78deda
Packit 78deda

Packit 78deda
XPM Manual by Arnaud Le Hors 
Packit 78deda
HREF="mailto:lehors@mirsa.inria.fr">lehors@mirsa.inria.fr
Packit 78deda
Packit 78deda

AUTHOR

Packit 78deda
Packit 78deda

Packit 78deda
Copyright (C) 1990 by Mark W. Snitily.
Packit 78deda

Packit 78deda
Permission to use, copy, modify, and distribute this software and its
Packit 78deda
documentation for any purpose and without fee is hereby granted, provided
Packit 78deda
that the above copyright notice appear in all copies and that both that
Packit 78deda
copyright notice and this permission notice appear in supporting
Packit 78deda
documentation.  This software is provided "as is" without express or
Packit 78deda
implied warranty.
Packit 78deda

Packit 78deda
This tool was developed for Schlumberger Technologies, ATE Division, and
Packit 78deda
with their permission is being made available to the public with the above
Packit 78deda
copyright notice and permission notice.
Packit 78deda
Packit 78deda

Upgraded to XPM2 by Paul Breslaw, Mecasoft SA, Zurich, Switzerland (

Packit 78deda
HREF="mailto:paul@mecazh.uu.ch">paul@mecazh.uu.ch), November 8,
Packit 78deda
1990.
Packit 78deda
Packit 78deda

Upgraded to XPM version 3 by Arnaud Le Hors(

Packit 78deda
HREF="mailto:lehors@mirsa.inria.fr">lehors@mirsa.inria.fr), April
Packit 78deda
9, 1991.
Packit 78deda
Packit 78deda

Packit 78deda
 
Packit 78deda

Table Of Contents

Packit 78deda
    Packit 78deda
  • SYNOPSIS
  • Packit 78deda
  • DESCRIPTION
  • Packit 78deda
  • OPTIONS
  • Packit 78deda
  • SEE ALSO
  • Packit 78deda
  • AUTHOR
  • Packit 78deda
    Packit 78deda
    </BODY>
    Packit 78deda
    </HTML>