Re: How to don't use symbolic color within xpm

Anthony Thyssen <[email protected]>
Newsgroups gmane.comp.video.image-magick.user
Message-ID <20100720122520.7dc9cbbd@wraith>
On Mon, 19 Jul 2010 10:37:48 -0400
[email protected] wrote:
| Hi,
| 
| I want to convert png image to xpm (using convert image.png convert.xpm) 
| but the file has some symbolic color, e.g:
| 
| "1  c gray82",
| 
| I have some problem to show the image on Windows computer (ok with 
| Linux). If I change the symbolic color with the hex value, e.g.:
| 
| "1  c #D1D1D1",
| 
| then everything is ok. I was wondering if it's possible to use an 
| argument with convert to use hex value everytime.
| 
I had this problem a long time ago.

My solution was a shell script that looks up the colors, and replaces
the hex stringa with X window color names.

The scripts for this is part on my old "Anthony's Icon Library"
   http://www.cit.griffith.edu.au/~anthony/icons/

Specifically the script directory in
   http://www.cit.griffith.edu.au/~anthony/icons/support/scripts/Icons.html

And the scripts
    xpm-fix        Fix the X pixmap output from pbmplus (restore color names)
    color_db_mk    Create a reverse color name database (for xpm-fix)

These are also related.
    colorname      find the rgb.txt colorname of a pixel #rrggbb value
    color_lookup   Print the #rrggbb pixel value for a named X window color

The "color_db_mk" creates a small table of hex to color names dealing
with the fact that some hex values has multiple color names in the X11
RGB color table.

The "xpm-fix" uses the table to substitute the hex values with color names.

NOTE this is OLD stuff.  I make no guarantees.


  Anthony Thyssen ( System Programmer )    <[email protected]>
 --------------------------------------------------------------------------
   And so, may Evil beware and may Good dress warmly
   and eat lots of fresh vegetables.   -- Tick, "The Tick"
 --------------------------------------------------------------------------
   Anthony's Castle     http://www.cit.griffith.edu.au/~anthony/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.