Trouble setting pixels in a bitmap

J

James Dean

I get the following message when i try to set a pixel in the
bitmap.......whats wrong and how can i fix it.......

"Additional information: SetPixel is not supported for images with
indexed pixel formats."

this is the code.........


bitmap.SetPixel(biheight,biwidth,Color.Black);
The get pixel works perfect but not this........
 
G

Guest

Hi James,
I get the following message when i try to set a pixel in the
bitmap.......whats wrong and how can i fix it.......

"Additional information: SetPixel is not supported for images with
indexed pixel formats."

this is the code.........


bitmap.SetPixel(biheight,biwidth,Color.Black);
The get pixel works perfect but not this........

Try using colors from bitmap palette e.g. by:
Color[] paletteColors=bitmap.Palette.Entries;

If this won't work then only solution i see is
to convert your bitmap to 24bpp pixel format.

Remeber that GetPixel & SetPixel methods are very
unefficient!

Cheers

Marcin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top