C-Services Holland b.v.
1/6/2005 12:32:00 PM
marfi95@yahoo.com wrote:
> I'm trying to implement some code in vb.net to allow the user to
> adjust the brightness or contrast on an image (through the use of a
> slider) that is already black & white in the bitmap. I have tried
> to use the colormatrix and even down to the pixel using GetPixel and
> SetPixel in system.drawing, but I'm really not up on using gdi+ and
> haven't really gotten anywhere. I've seen some examples for VB6, but
> I need vb.net.
>
> I know that all the pixels are either 255 or 0 already since its black
> and white, but if you are adusting the brightness, how do you decide
> which pixels to turn white or black based on how much the user wants
> to brighten/darken. I've got code to read & set each pixel, but I
> just dont know what to use to decide what to set the new pixel to.
>
> If you someone could post some code or point me to a good example that
> explains whats going on, I would be most appreciative.
>
> Thanks,
> Mark
>
>
If your values are at 0 or 255 you've got maximum contrast. You can't
decrease contrast for just a few pixels since there would be no way to
determine what pixels should remain white/black and what pixels should
turn some shade of grey. You could only decrease the contrast by
bringing the 0 and 255 values closer together, but don't expect some
gradient to appear.
--
Rinze van Huizen
C-Services Holland b.v.