Hi,
I am getting unexpected results when I call ImageAttributes.SetGamma. Specifically, calling with a parameter less than 1.0 causes the drawn bitmap to be brighter, and with param more than 1.0 causes the bitmap to come out darker. At least something is happening, but I thought that higher gamma values are associated with increased intensity. (but this may just be my misunderstanding). Is this the way it's supposed to work Thanks for any help...(oh, here is a code fragment)...
ImageAttributes imageAttr = new ImageAttributes();imageAttr.SetGamma( newGamma );
Bitmap newBitmap = new Bitmap( this.Width, this.Height, this.PixelFormat );
Graphics g = Graphics.FromImage( newBitmap );
Rectangle rect = new Rectangle( new Point( 0, 0 ), new Size( this.Width, this.Height ) );
g.DrawImage( this.Bitmap, rect, 0, 0, this.Width, this.Height, GraphicsUnit.Pixel,
imageAttr ); // image color intensity comes out opposite to what I expected...

GDI+ Question: ImageAttributes.SetGamma
patrick_henry_1776
I am also having this problem (using VB 2005 Express). The higher the value, the darker the image. Have you (or anyone else out there! ) found a solution
Thanks
AB
Larry Wilson
Thank you for responding, but i was trying to indicate, perhaps not with the greatest skill, that the OPPOSITE was happening for me. The higher the gamma I set, the darker the image gets. If I set it above 1, it gets darker, and below, brighter Can someone spot something wrong with my code
Thanks
VValdo
Try to trace your routine and fix the bug
Asaf Helfer
PJ,
thanks for your persistence on this. I'll have to recheck my code. There may be some problem with the way I am passing the parameter into the routine that applies the gamma -- it is pretty bizzare that I am getting "inverted" results...If I have no luck, I'll try posting again.
Thanks
Joenormal
- http://img80.imageshack.us/img80/7784/gamma11yl.jpg
- http://img80.imageshack.us/img80/8702/gamma53mp.jpg
The code i used it allmost exactly yours.gary ggerberdom