------------------------------------------------------------------------------- Too many colors used to be a problem cause by limitations of psudeo color displays. Such monitors disappeared when WWW browsers appeared, making the probelm worse, it forced manufacturers of computer equiment switched to using full direct color monitors. ------------------------------------------------------------------------------- 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 similar problem with colors for icons. If I just use them as contributed, each using a different set of colors, you will quickly run out of colors on a Psuedo-Color X window Display. Anthony's X Windows Icon Library (AIcons) https://antofthy.gitlab.io/aicons/ 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.. https://antofthy.gitlab.io/aicons/docs/colortable.html For the final color selections https://antofthy.gitlab.io/aicons/docs/colors.html or in a X pixmap file https://antofthy.gitlab.io/aicons/desc/cl-misc/colortable.xpm ------------------------------------------------------------------------------- Recoloring... 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 concatenated 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 The Colormap I use is available at https://antofthy.gitlab.io/aicons/local/colormap.ppm or in X pixmap format (not directly usable by `ppmquant' https://antofthy.gitlab.io/aicons/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 https://antofthy.gitlab.io/aicons/support/scripts/ The specific script to recolor icons is called "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 current 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) The "ppmquant" program is NOT the only program that can be used for remapping 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 using a Pseudo color (256 colors only) display. 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---------- #/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---------- The -geometry places the image underneath my xclock which is started later in the sequence. I also recommend "ctwm" for setting 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. -------------------------------------------------------------------------------