I'm reading an 8 bit png file into a Bitmap in C# .net 3.5. I'm targetting a particular pixel on the image which is RGB value 255,255,255 ie white, when being read through any normal program like paint.net. However, when i read it in through the methods GetPixel or through locking bits and accessing it the pointer way both yield a result of either 62,62,62 or the single byte colour value of 62. So, my question is, why am i getting the value of 62 instead of 255?
Any insight would be great :D.
Sounds like your screen is set to 16-bit color depth. This means that each pixel is described by 16 bits: 5 red, 6 green, 5 blue, with each channel value ranging from 0 to 31 (2^5-1) or 63 (2^6-1). Your white pixel is represented as (31,63,31), which presumably gets adjusted to (62,62,62).
Programs like Paint.Net do their own bitmap processing and don't depend on the system's Bitmap class, so they're not dependent on the screen's color depth.
So, try setting your screen to 32-bit color depth - Your pixel will be represented as (255,255,255). Note that in 32-bit color depth, usually only 24 bits are used to color channels - the last 8 are either Alpha (transparency) or unused.