Subject: FVWM: Reducing color use for pixmaps (home made solution)

From: Romano Giannetti <[email-masked]>
Date: Wed, 13 Mar 1996 20:03:34 +0100 (MET)

Well... thanks for all the nice advices, but really I did not like 
to install some giant image elaboration package for this... so, I made a 
little program that seem to work. This is the README:

******************
This is a little stupid program to reduce the number of colors
of a pixmap set.
Use:

   pixy [-v] base.xpm icon.xpm > newicon.xpm

after this magic, newicon.xpm will have its color changed to the
nearer one of base.xpm. Next, if you want to get rid of duplicate
colormap entries, do a

   sxpm -nod appl2.xpm -o appl3.xpm

and you have it.

Enjoy! 
**********************

... well, it is really an hack and it control almost nothing on 
correctness of parameters etc etc... so keep attention. I have used 
it one hour without problems. 

find it on: 
		ftp://sirio.iet.unipi.it/pub/romano/pixy.tar.gz

No version number because I really do not know if I'll like to support 
and/or improve it.

Bye,
	Romano.

------------------------------------------------------------------
Dr. Romano Giannetti     Dip. di Ingegneria dell'Informazione 
Researcher               Elettronica Informatica Telecomunicazioni
[email-masked]      University of Pisa
------------------------------------------------------------------

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: <[email-masked]> (Charles Hines)
Date: Wed, 13 Mar 1996 14:15:49 -0500

>>>>> "RG" == Romano Giannetti <[email-masked]> writes:

RG> Well... thanks for all the nice advices, but really I did not like
RG> to install some giant image elaboration package for this... so, I
RG> made a little program that seem to work. This is the README:
....
RG> ... well, it is really an hack and it control almost nothing on
RG> correctness of parameters etc etc... so keep attention. I have used
RG> it one hour without problems.

Dan Espen also wrote a similar program (which I meant to mention the
other day when this thread came up) that I was planning on putting
into the next release in the utils directory (if it's ok with him - I
don't recall if I asked him yet or not).  I also plan on using his to
reduce some of the included pixmaps too (sometime).

I'll put yours in there too, if you'd like.

Chuck

---

From: Dan Espen <[email-masked]>
Date: Thu, 14 Mar 1996 10:23:47 -0500

----------
> reduce some of the included pixmaps too (sometime).

Chuck, Romano takes   the same approach  to  color reduction that   my
program did, but he did a better job of it.   I would suggest that you
only include Romano's version.

I don't think either of us has worked out what set  of colors the xpms
should be reduced to using.  If anyone else on the  list has some good
ideas about how  the subset  of colors should  be determined  I know I
would be interested.

--
Dan Espen                                    Phone: (908) 699-5570
[email-masked]
444 Hoes Lane  Room RRC 1C-214
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: tim werner <[email-masked]>
Date: Thu, 14 Mar 1996 14:04:01 -0500

>Date: Thu, 14 Mar 1996 10:23:47 -0500
>From: Dan Espen <[email-masked]>

>If anyone else on the  list has some good

Only this.  I have two lines in my .Xdefaults for netscape because it
was stealing colors from my other apps, especially the screen saver, but
other stuff as well.  I don't know how it's implemented in netscape, or
how it's related, but maybe fvwm could use some similar approach.  (It
doesn't seem to make netscape any less colorful to limit it to 64
colors, BTW.)

   ! make sure netscape only uses 64 colors
   Netscape*installColormap:	No
   Netscape*maxImageColors:	64

regards,
tw

---

From: Romano Giannetti <[email-masked]>
Date: Thu, 14 Mar 1996 20:41:21 +0100 (MET)

> doesn't seem to make netscape any less colorful to limit it to 64

Yes, but netscape do dithering (I think) and in big images it is 
perfect doing so. I tried reducing color in icons with netpbm, but in 
very little images, with strenght color contrast, results are, well,
not so good. Then if I remember well those lines limit the colormap mosaic 
uses in included images, _not_ in pixmap it is using to display buttons 
etc... (nice trick :-) so it look right. 

I tried reducing my whole iconset to 16 colors (the same 20) and it look
quite good for almost all the icons. Almost :-). With 32 colors, if the
subset is good, I think it will look good.  

Bye,
	Romano

---

From: Martin Kraemer <[email-masked]>
Date: Fri, 15 Mar 1996 10:13:09 +0100 (MET)

Romano Giannetti wrote...
> not so good.

I liked the way `xv' does the color reduction when it cannot allocate
all colors. I think that's an algorithm based on the number of color cells
which are still available for free programming; only in very rare cases
does it have to re-use color cells which have been allocated by a
different program.

> subset is good, I think it will look good.  

Congratulations, Romano:
I think your program was the by now very best approach to the problem. One
"only" needs the "most suitable" set of colors. (Maybe one should really
reduce all icon's color entries to 8 bit, or even 4 bit, by forcing the
color's low order nibble to 0, before one calls pixy?)

I tried it with a set of 32 colors, 16 of which are those thich Win95/Win3
uses in its icons. Here's my 32col.xpm file (even though I'm still not
completely satisfied with the results):

/* XPM */
static char * col32_xpm[] = {
"32 23 32 1",
" 	s none	m none	c none",
".	c #000000",
"X	c #202020",
"o	c #404040",
"O	c #808080",
"+	c #C0C0C0",
"@	c #FFFFFF",
"#	c #0000FF",
"$	c #FF00FF",
"%	c #FF0000",
"&	c #FFC000",
"*	c #FFFF00",
"=	c #00FF00",
"-	c #00FFFF",
";	c #0000C0",
":	c #C000C0",
">	c #C00000",
",	c #FF8000",
"<	c #C0C000",
"1	c #00C000",
"2	c #00C0C0",
"3	c #000080",
"4	c #800080",
"5	c #800000",
"6	c #C08000",
"7	c #808000",
"8	c #008000",
"9	c #008080",
"A	c #A0A0A0",
"I	c #101010",
"Y	c #606060",
"E	c #E0E0E0",
" ...IIIXXXoooYYYOOOAAA+++EEE@@@ ",
" ...IIIXXXoooYYYOOOAAA+++EEE@@@ ",
" ...IIIXXXoooYYYOOOAAA+++EEE@@@ ",
" ...IIIXXXoooYYYOOOAAA+++EEE@@@ ",
" ...IIIXXXoooYYYOOOAAA+++EEE@@@ ",
"                                ",
"####$$$$%%%%&&&&****====----####",
"####$$$$%%%%&&&&****====----####",
"####$$$$%%%%&&&&****====----####",
"####$$$$%%%%&&&&****====----####",
"####$$$$%%%%&&&&****====----####",
"                                ",
";;;;::::>>>>,,,,<<<<11112222;;;;",
";;;;::::>>>>,,,,<<<<11112222;;;;",
";;;;::::>>>>,,,,<<<<11112222;;;;",
";;;;::::>>>>,,,,<<<<11112222;;;;",
";;;;::::>>>>,,,,<<<<11112222;;;;",
"                                ",
"33334444555566667777888899993333",
"33334444555566667777888899993333",
"33334444555566667777888899993333",
"33334444555566667777888899993333",
"33334444555566667777888899993333"};

Oh, yeah, Romano, you should really put your email address somewhere into
the sources. I didn't find it anywhere and had already dropped your
announcement...

    Martin
--
| S I E M E N S |   [email-masked]   |       Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |   Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |    81730 Munich, Germany
~~~~~~~~~~~~~~~~ My opinions only, of course; pgp key available on request
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].