Color similarity/distance in RGBA color space

前端 未结 5 930
遇见更好的自我
遇见更好的自我 2020-12-23 14:22

How to compute similarity between two colors in RGBA color space? (where the background color is unknown of course)

I need to remap an RGBA image to

5条回答
  •  天命终不由人
    2020-12-23 14:56

    I've never done it, but theory and practice say that converting the RGB values in the image and the palette to luminance–chrominance will help you find the best matches. I'd leave the alpha channel alone, as transparency should have little to nothing to do with the 'looking better' part.

    This xmass I made some photomosaics for presents using open-source software that matches fragments of the original image to a collection of images. That seems like a harder problem than the one you're trying to solve. One of them programs was metapixel.

    Lastly, the best option should be to use an existing library to convert the image to a format, like PNG, in which you can control the palette.

提交回复
热议问题