pixy(1) pixy(1)
3/10/96
NAME
pixy - reduces the number of colors used in XPM (pixmap) files
SYNOPSIS
pixy base.xpm icon.xpm > newicon.xpm
DESCRIPTION
This is a little program to reduce the number of colors of a set of
pixmap files to a fixed predefined set of colors.
Often, especially with the recent xpm-icon capable window managers
like fvwm , people have the problem that their color map is almost
full after starting the window manager, thus preventing other
applications from using a sensible number of still available colors.
Of course, this is mostly a problem with 8-bit deep displays; they
have only 256 available colors in their color palette.
HOW IS THIS ACHIEVED?
pixy takes two files, one (base file) with the set of predefined
colors to use, and another (the image file) from which it compares
every color with the colors of the base file.
The resulting file is the image file with every color replaced by the
closest color from the base file; this file is sent to stdout or to a
given new file name.
The "closest" color is determined by finding the shortest distance in
the HVC color space. This is the most intuitive transformation because
the relative distances in HVC space approximate best the human feeling
of similarity, both in color and in brightness.
Because after replacement chances are that you end up with a lot of
pixmap color entries using the same (reduced) color, all duplicate
colors are eliminated by piping the output through the sxpm program
(you can find it as part of the xpm distribution. When called with the
"-nod" switch, it doesn't display the picture but only reduces all
duplicate colors).
Usage:
pixy base.xpm icon.xpm > newicon.xpm
after this, newicon.xpm will have each of its colors changed to the
nearest one taken from the colors in base.xpm.
- 1 - Formatted: June 9, 2026
pixy(1) pixy(1)
3/10/96
You have a whole bunch of options to manipulate the transformation
process: try to start pixy without arguments and it will show the
options.
Options:
-V Display program version and exit
-v Verbose messages to stderr
-n Do not fork sxpm -nod to
-o file Save converted image in
-r r:g:b Use RGB distances, weights
-h hc:v Use HVC distances. This
-t t Rotate the image's color
-m m Substitute only if dist
The most interesting part of the transformation algorithm is the
metric used to compute color distances. By default pixy uses plain
TekHVC metric, which seems (they say :-) to give a "real" visual
distance between colors.
You can add a weight to the calculation, e.g. giving more importance
to chroma than to luminosity by giving parameters (e.g., try --hvc 3:1
for small icons).
Or you can choose a cubic rgb distance, with every primary color
weighted independently, or both weighings together (although the
usefulness of this is not so clear). Flag --verbose (-v) is quite
nice, it shows you what's going on inside pixy.
In pixy , "Color Distances" are measured internally as the _square_ of
the distances in color space. Since RGB space consists of a
100x100x100 cube and the HC and V components in HVC space lie between
0 and 100 as well, this results in a distance 0...10000 in each
direction. To improve the conversion algorithm, you can optionally
specify a maximum distance for the substitutions: if you say --max
200, only color substitutions with a distance less than or equal to
200 will be performed. To get an idea, for my eyes a distance of 100
is difficult to see. For icons, a distance of up to 500 is most of the
times acceptable.
To get to know more about colors, especially about the TekHVC color
space, point your preferred WWW browser to ...
http://hpux.cict.fr/man/X11/Graphics/xtici-1.0/xtici-1.0.html
- 2 - Formatted: June 9, 2026
pixy(1) pixy(1)
3/10/96
Download and read the documentation, especially doc/tc_ed_ch1.ps
Old versions of pixy required running sxpm by hand to reduce colors.
This is no longer necessary; sxpm -nod is called automatically now.
TEMPLATE FILES
In /opt/hppd/lib/pixy :
all.xpm:
Romano, playing with awk and rgb.txt, created a dummy pixmap
called all.xpm that you find here. Do not try to visualize it. Do not
let sxpm reduce it to normalized one. Its use is as a base pixmap to
transform image pixmaps with numeric RGB color specifications of the
form #456790984567 into equivalent pixmaps using only named colors,
greatly increasing the probability of color reuse in your X server.
32col.xpm 16col.xpm:
Need an explanation?
32num.xpm:
32-colors pixmap with numeric color specification.
AUTHORS:
Romano Giannetti (romano@iet.unipi.it) Martin Kraemer
(Martin.Kraemer@Mch.SNI.De)
Thanks to Dan Espen <dane@bae.bellcore.com> Man page by Steff
<steff@csc.liv.ac.uk>
STANDARD DISCLAIMER:
This software is released "as is". We do not want to hear people
crying after their precious icon collection was reduced to black and
white due to a bug :-)
- 3 - Formatted: June 9, 2026