最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Generate palette for palette swapping programmatically? - Stack Overflow

programmeradmin1浏览0评论

In the above gif, the colors of the sprite are changed. This is easy to do if one maps the colors from the original palette to the desired palette and then iterates over each pixel of the original image and changes the color accordingly. For example, one can define a map like this:

My question is, how can one define the new palette programmatically ? For example, if the original palette is Green, and I want to create a new palette in Red, then rather than having to create a mapping of each color in the green palette to the equivalent red color in the new palette, is there a way to automatically generate the entire red palette mapping by specifying just ONE color, and computing the others based on the hue,saturation or luminance or something (I don't know the right technical terms)? I imagine there is some relationship between the colors on the source palette, so if one defines one of the colors in the destination palette, then using the same relationship one can generate the entire palette from a single color.

Don't know enough about colors to know the right terms to define my problem, but I am sure that the calculations would be simple enough. Is my idea correct ? Solution can be in any programming language. I don't mind.

发布评论

评论列表(0)

  1. 暂无评论