Why is .NET `PixelFormat` has an `Format8bppIndexed` element?

A group of 8 bits can store 256 values.

A gray level can have 256 variations.

So, why do they need Format8bppIndexed? Why is it Indexed?

Why not Format8bpp ?

Jon Skeet
people
quotationmark

It's indexed because each value is an index into a colour table, which may well be RGB or RGBA with considerably more depth. For example, you could have a palette of 32-bit entries (8 bits for each of red, green, blue and alpha), but the palette itself only has 256 entries, so you can represent each pixel with a single byte. This is (or used to be, at least) common in PNG files.

If you look down the PixelFormat enumeration, you'll see that most values compose two pieces of information:

  • Number of bits
  • What those bits represent, out of:
    • Greyscale
    • ARGB / RGB
    • Indexed

people

See more on this question at Stackoverflow