1
votes

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.

1
So you want us to guess how your "custom image format" works? You might want to start here: en.wikipedia.org/wiki/Indexed_colorMatt Burland
Custom format + Single Byte = ???. Are you using a RGB format? Indexed colors? Something else? When it is custom, then how is a color defined?Sebastian Mach
@MattBurland - If it was my custom format I wouldn't be having this issue... I'm doing my best to reverse engineer the format that these images use. They are all the same size and use the same pallet so they just yanked all of that information out... unfortunately I don't know what the pallet is.Peter
Generally, in such formats, the palette is part of the file, and you just need to find it. Open it in a hex editor, look through it, check the boundaries of the image data itself, and see what else is around them.Nyerguds

1 Answers

1
votes

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

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