views:

21

answers:

2

Hello, I have two indexed (8-bits) Bitamp, both using the same Palette in C# (.NET Framework 2.0). I want to bit block copy pixels from one onto another on designated coordinates. I had tried to use Graphics class, but get exception that it doesn't work with indexed colors, I tried also with getpixel()/setpixel() but get the same exception. It doesn't need to be quick it just have to work. And I CAN'T convert to non-indexed image and vice-versa - palette is very important for me and I can't loose any information about it.

+1  A: 

GDI+ supports indexed formats very poorly. Things got better with Vista which included an update to gdiplus.dll to version 1.10. Nothing you should could on I imagine. You could hack Bitmap.Lock(), dealing with the single byte-per-pixel format is doable. But get these images into a 24 or 32bpp format I'd say.

Hans Passant
As I said - I can't: even change of the order of colors in palette is unacceptable
PiotrK
+1  A: 

You may use the http://www.imagemagick.org/script/api.php

Ertan
Sorry, but this is not acceptable - imagemagick's alters my palette settings (as I said, I must by absolutely sure that palette won't change, ie. the order of colors will be kept)
PiotrK
what is the image format you working on ? bmp? gif?
Ertan