Peter
Peter

Reputation: 9712

Get Color from Byte for 256 color image

I have a custom image format (not mine, I am trying to reverse engineer it) that I am parsing. The images are stored in 256 color, the color for any given pixel is represented by a single byte. How can I convert that byte to a color? My guess is it uses some sort of standard pallet, but I wasn't sure how to access a standard 256 color pallet in c# to look up colors. No pallet or other information is included in the image; all the images are the same dimension and all use the same mysterious pallet.

Kind of like Get Color from int, but not gray scale.

Upvotes: 1

Views: 1515

Answers (1)

ekholm
ekholm

Reputation: 2573

The BitmapPalettes class provides some standard color palettes. Perhaps WebPalette could be worth a try:

Color c = BitmapPalettes.WebPalette.Colors[colorIndex];

Upvotes: 1

Related Questions