ppmtoxpm

Updated: Feb 22 2003
Index  

NAME

ppmtoxpm - convert a PPM image into an X11 pixmap  

SYNOPSIS

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

Minimum unique abbreviation of option is acceptable. You may use double hypens 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.  

DESCRIPTION

ppmtoxpm reads a PPM image as input and produces X11 pixmap (version 3) as output. This format can be loaded by the XPM library.

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. By default, ppmtoxpbm tries to find a name for each color in the image in the system color dictionary, and if it finds one, uses it. If it doesn't it uses hexadecimal. You can force ppmtoxpbm to use hexadecimal only with the -hexonly option. You can specify a different color dictionary with the -rgb option.

When ppmtoxpm 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, ppmtoxpm uses 2 digits per component, as in "#FF0000".

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 pnmdepth 255.  

OPTIONS

-name=xpmname
This option specifies the prefix string which is specified in the resulting XPM output. If you don't use the -name otpion, ppmtoxpm defaults to the filename (without extension) of the ppmfile parameter. If you do not specify -name or ppmfile (i.e. your input is from Standard Input), the prefix string defaults to the string noname.
-hexonly
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.

This option was introduce in Netpbm 10.15 (April 2003). Before that, it was the default, overridden by specifying -rgb.

-rgb=rgb-textfile
This option names the file in which the color dictionary you want to use resides. By default, ppmtoxpm uses the system color dictionary.

This option in meaningless when you specify -hexonly.

Before Netpbm 10.15 (March 2003), ppmtoxpm did not default to the system color dictionary. If you didn't specify -rgb, ppmtoxpbm would use only hexadecimal color specifiers.

-alphamask=pgmfile
This option names a PGM file to use as an alpha (transparency) mask. The file must contain an image the same dimensions as the input image. ppmtoxpm marks as transparent any pixel whose position in the alpha mask image is at most half white.

If you don't specify -alphamask, ppmtoxpm makes all pixels in the output opaque.

ppmcolormask is one way to generate an alpha mask file. You might also generate it by extracting transparency information from an XPM file with the -alphaout option to xpmtoppm.

There are similar options on other Netpbm converters that convert from formats that include transparency information too.

 

SEE ALSO

ppmcolormask, xpmtoppm, pnmdepth, ppm
XPM Manual by Arnaud Le Hors lehors@mirsa.inria.fr  

AUTHOR

Copyright (C) 1990 by Mark W. Snitily.

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.

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.

Upgraded to XPM2 by
   Paul Breslaw, Mecasoft SA, Zurich, Switzerland (paul@mecazh.uu.ch)
   Thu Nov  8 16:01:17 1990

Upgraded to XPM version 3 by
   Arnaud Le Hors (lehors@mirsa.inria.fr)
   Tue Apr 9 1991


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
SEE ALSO
AUTHOR