Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help Converting an Images Colors to the closest one in a palette
#4
(08-16-2025, 05:25 PM)Aminivibrio Wrote:
(08-16-2025, 05:03 PM)Ofnuts Wrote: A 2K colors palette doesn't make much sense. Could it be just a low-resolution palette where colors are encoded on 11 bits, in which case it would just be a matter of rounding up the colors values?

Unfortunately,  I really don't know what that means. I really hope I don't come off as rude or condescending but I genuinely have no clue.

When the palette is 256 colors or less, you can encode a pixel on one byte (instead of 3).

When the palette has around 2K colors, you need at least 11 bits to specify a color in the palette. Since on a PC the bits come in indivisible groups of 8 (bytes) you will have to encode the image with two bytes per pixel (instead of the usual 3): not much savings for a lot of complexity.

There are a few encoding schemes where colors are stored in fewer than 8 bits. For instance, with 32 levels for red and blue (5 bits) and 64 for green (6 bits)(*), you can encode a pixel on 5+6+5=16 bits=2 bytes. This is as complex as above, but in the early days (PC with CGA/EGA) the hardware could use the encoding directly.

So, your 2K palette makes me wonder if the underlying rule is just that colors are encoded with fewer bits, in which case you wouldn't be using an arbitrary mapping but just a reduction of the number of color levels. And this would be what Colors > Dither does.

(*) because our eyes are mostly sensitive to green, and image brightness is mostly from the green channel
Reply


Messages In This Thread
RE: Need help Converting an Images Colors to the closest one in a palette - by Ofnuts - 08-17-2025, 07:37 AM

Forum Jump: