# Thread: Colour theory... (weird title)

1. ## Colour theory... (weird title)

First of all, I don't need help with the actual programming. Only the theory.

I'm working on a program that are converting a 256 colour picture with a certain palette into a new picture (also 256 colours) with another palette. Since there are different palettes, the colours will be screwed up if you just copy the data.

Therefore, the program must find the colour (in the new palette) that matches the old colour the best.

To do this, I use the Red, Green and Blue values in the colour as the three axises in a 3D coordinate system. And to find the colour that is the best match, I simply pick the colour that is closest to this point in the coordinate system (using Pythagoras).

What do you think? Is this the right way to do this?
Or is the closest colour not neccesarily the colour that looks most alike?

2. As long as all three colour components are similar, the resulting colour will be similar. If you set up a simple app with a coloured box, then set some other boxes up around it with, say, +/- 10 on each of the colour components, you are unlikely to notice the difference in the resulting colours.

What will make a difference is if two of the components match closely, but the other is way out. Your method would seem to be okay, if the new palette is broadly similar to the old. If it is very different, the nearest match in 3d may still be a long way out.

3. You can also use dithering techniques like error diffusion. A search on google should turn out many results.

4. ## It's done

The bitmap converting program is done. If anyone is interested, you can download it below (the attachment). It has a pretty good result when converting .