tags:

views:

55

answers:

1

My program im working on does grayscale, builds an alpha mask, and splits the color channels. How do you invert a picture?

the above are done looking at the image pixel by pixel.

Im using vb2005.net, for the sake of speed is there other ways of doing those things using drawing.graphics?

A: 

See this. You'll basically have to use either ColorMatrix:

new float[][]
{
   new float[] {-1, 0, 0, 0, 0},
   new float[] {0, -1, 0, 0, 0},
   new float[] {0, 0, -1, 0, 0},
   new float[] {0, 0, 0, 1, 0},
   new float[] {1, 1, 1, 0, 1}
}

or unsafe processing (not sure if this particular one can be done in VB.NET)

Anton Gogolev
The first sentence of that article is wrong - it's implementing lumainversion ( inverting the luma channel value in HSL space by inverting each colour channel in RGB space ) but says you invert the colours ( cromainversion - mapping each pixel to the opposite colour by adding 180 degrees to hue in HSL space ).
Pete Kirkham