Conversation

What's the best way to transform a 256 colour image to a 64 colour one where the second 32 colours are the same as the first 32 except with half the RGB values and I don't want to use dithering? Someone must have done a good one for Amiga EHB mode at some point but I am having no joy whatsoever in finding one, and I am not good enough at colour theory to know how to work sensibly within that constraint

3
1
0
@mjg59 I would say aseprite (or similar image editors with good palettised image support) with a custom palette. First reducing the palette down to 32 colours from the image and then expanding that palette to 64 colours should be pretty easy, but maybe you can use the colour curves to remove all colours darker than 128 from the image when you make the palette to have a little better performance.

I don't know of any dedicated algorithm but someone in the Amiga world would probably have made that at some point, they are quite clever in terms of custom tools.
0
0
0

@mjg59 absolutely no warranty implied, but this is a script I hacked together which converts an image to a specific palette (by pulling all colors from a sample palette image): https://gist.github.com/0xabad1dea/844220f07076f612c7c26128ceb3bef3

and this is a script I hacked together which reduces the colors in an image to a target number while preserving fidelity as much as possible: https://colab.research.google.com/drive/1QCfC-49sbxhc_kT6wFEzHnK60-lFcvGn

between the two of them, you should be able to kludge something unholy into existence

0
0
0

@mjg59 how fast do you need the algorithm to be? I have some existing code that does almost exactly what you're asking for, but it involves scipy.minimize

1
0
0

@gsuberland 600 times a second (only 320 pixels per iteration, though)

1
0
0

@mjg59 @gsuberland oh, see, when I sent you my python scripts for color conversion, I didn’t realize you needed it done in realtime video 😂 sorry about that

0
0
0