wrote... | I have a bunch of color xpm files, which are the faces of people who | I'm in contact with. (The xpm files contain a big number of colours). | When xfaces is showing the xpm files, the program steals all the | colors in the color-map, causing other applications to fail in | allocating colours. | | - How can I reduce the number of colours in xpm files?. (Any X-Windows | program that does this?, I was using 'xv', but it seems to produce a | corrupted xpm file if I save it with a reduced color set.) | I am the coordinator for Anthony's X Windows Icon library (started 1991) and had a simular problem with colors for icons. If you just use them as contributed, each used a a set of colors and every icon used a different set. Anthony's X Windows Icon Library (AIcons) http://www.cit.gu.edu.au/~anthony/icons/ My solution was to pick a set of 30 or so colors and recolor all the icons to this set. For the color picking process what was wanted etc. see.. http://www.cit.gu.edu.au/~anthony/icons/docs/colortable.html For the final color selections http://www.cit.gu.edu.au/~anthony/icons/docs/colors.html or in a X pixmap file http://www.cit.gu.edu.au/~anthony/icons/desc/cl-misc/colortable.xpm Now for your solution. The core program I used to recolor icons (X pixmaps) was the PbmPlus filter ``ppmquant'' This can take a `ppm' file of colors and either dither images into this map (your need) or replace the colors (my need). It can also just reduce the colors used, but the colors picked may not be the same across all images in that case (unless all images are concatanated in to image to give to the program). As such I recommend creating a ppm colormap. `ppmquant' is part of the pbmplus (netpbm) filter package ftp://ftp.cit.gu.edu.au/pub/users/A.Thyssen/netpbm-1mar94.p1.tgz The Colormap I use is available at http://www.cit.gu.edu.au/~anthony/icons/local/colormap.ppm or in X pixmap format (not directly usable by `ppmquant' http://www.cit.gu.edu.au/~anthony/icons/desc/cl-misc/colormap.xpm ASIDE: A colormap is just a ppm image with the colors wanted in it. Often just one pixel for each color wanted to make it minimal. The `ppmquant' can only be run on one image, also I wanted to recolor whole directories of X Pixmap images, so I wrote quite a number of scripts to convert the X Pixmaps to ppmplus, recolor them, convert them back AND fix the color names which ppmplus filters delete. All these scripts can be found in the AIcons support script area http://www.cit.gu.edu.au/~anthony/icons/support/scripts/ or download this support files from ftp://ftp.cit.gu.edu.au/pub/AIcons/support.tar.gz The specific script to recolor icons is called (suprise) `recolor' EG: recolor *.xpm or recolor -fs *.xpm # dithered recolor or recolor -fs -f colormap.ppm *.xpm # with this colormap This will recolor all X Pixmaps in the corrent directory renaming them from name.xpm to name_recol.xpm or is the number of colors was reduced name_recol_bad.xpm WARNING: recolor depends on other scripts in the support scripts directory a couple of which also depend of perl being installed (to create and use a pixel->colorname database for the ppm image to X pixmap conversion) ppmquant is NOT the only program that can be used for remaping colors but so far all the other recolor `quantizers' to be to simplistic producing bad results. Particularly in the very light color ranges. ------------------------------------------------------------------------------- COLOR USAGE: I will make only one more suggestion... When I start my X windows session I want to ensure that programs like netscape do not grab the 30 or so `standard' colors I use for icons and applications. As such I want to assign those colors before netscape and others are run. To do this I have a line like the following in my .xsession or .xinitrc X windows startup file. =======8<--------CUT HERE----------axes/crowbars permitted--------------- #/bin/sh #... # ----- Get Server information --------- # set variables : WIDTH HEIGHT SERVERHOST CLIENTHOST HOST X/Y_RESOLUTION .... eval `xrdb -symbols | sed -n '/=/{s/-D\([^= ]*\)=*/\1=/gp;}'` HOST=`hostname` # correct this xrdb setting #... if [ $PLANES != 1 ]; then # color display # Load standard colortable to insure these color are present. sxpm -geometry 6x5-40-40 $HOME/icons/local/colormap.xpm & sleep 1 # pause a moment fi #... =======8<--------CUT HERE----------axes/crowbars permitted--------------- The -geometry places the image underneth my xclock which is started later in the sequence. I also recomend ctwm for seting the icons various programs use. I think that is enough for now. Use the above as you see fit and I hope all this helps. Anthony Thyssen ( System Programmer ) http://www.cit.gu.edu.au/~anthony/