On Mar 08, 2007, at 13:56 UTC, Emile SCHWARZ wrote:

> I use the following code to remove Green and Blue from the passed
> Picture (and get a cyan image! [1])

You haven't removed green and blue from the image with this code;
you've set the green and blue to full strength (255).  That's why you
get a cyan image; green + blue = cyan, and every pixel has
full-strength cyan in it, plus some varying amount of red (which will
make the combined color vary from pure cyan to white).

If you really want to remove green and blue, you should map them to 0,
not 255.  Then you'll have a red-scale image.

> I use the following code to transform a color image to get a
> GreyScale image:

>         // 'Create' the Grey pixel
>         aGrey = (aRed + aGreen + aBlue) / 3

Note that this isn't quite the right formula to make a grayscale image
that matches human perception of luminance.  But it's not too terrible,
either.  Search the archives for the right formula (maybe with keywords
"grayscale conversion" -- and try both spellings of "grey").

> Since under Linux this kind of methods takes forever to run, I _have_
> to use Map() / .Transform.
> 
> How can I do that with a Map ?

You can't.  Transform only operates on the red, blue, and green
channels individually.  A conversion to greyscale involves combining
information from all three channels; Transform can't do that.

On the other hand, I can't think of any technical reason why
RGBSurfaces *should* be slow under Linux.  I know that GTK makes some
kinds of graphics operations difficult, but you'd think that the
framework could get a pixel buffer, operate directly on the pixel
buffer in memory, and convert this back into a GTK picture only later,
maybe when the picture itself is next accessed.  It'd be worth a
feature request.

Meanwhile, if you're really stuck for a quick grayscale conversion on
Linux, you might consider operating on files with the shell class.  I'm
pretty sure there are some simple image-manipulation command-line tools
that are fairly standard on Linux.

Best,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to