On Thursday 21 February 2002 3:32 pm, Martin Vermeer wrote:
> On Thu, Feb 21, 2002 at 02:00:41PM +0000, Angus Leeming wrote:
>  
> > On Thursday 21 February 2002 1:39 pm, Asger K. Alstrup Nielsen wrote:
> > > On Thu, 21 Feb 2002, Angus Leeming wrote:
> > > 
> > > > and the problem is now defining an appropriate mapping from the colour
> > > > colourmap to a grayscale or monochrome one.
> > > 
> > > I'm not sure what the problem is, but if you want to convert from
> > > color to grayscale, just do this:
> > > 
> > >   int gray = (red + blue + green) / 3;
> > > 
> > > If you want to go monochrome, do this:
> > > 
> > >   bool black = gray >= 128;
> > > 
> > > Greets,
> > > 
> > > Asger
> > 
> > Thanks, Asger. I was playing already!
> > A
> 
> Hmm, I remember John Levon published a script for doing this automatically.
> 
>       http://www.movement.uklinux.net/patches/lyx/xpm.diff
> 
> Martin

Nice! However, in general, a converted file will only have c_colors. We need 
to generate the m_color or g_color entries on the fly if libXPM is to display 
monochrome or grayscale images. 

Now done.

Angus

Reply via email to