I need to “rotate” colors depending on a certain dependency, how do I calculate this?
I’m using no program, just working with a bitmap in C#
Every pixel, which is
R:193,G:0,B:0has to become
Now every other color needs to be switched in relation.
193/0/0has a neighbor pixel with
205/48/48, what I’m searching is the relative neighbor pixel of
Is there a way to calculate this, without getting values above 255 and beneath 0?
This is a complete stab in the dark, but here is what I would try: The HSL values are 200/100/35 and 0/100/76, so rotate the value of each H value by 200° and add 41% to each L value (clipped at 100).
More information from thebodzio‘s comment:
I think what you really have in mind is “mapping”. In that regard it’s
like any other mapping between two vector spaces (with some
clipping/wrapping; not necessarily bijective process). The problem is,
there’s infinitely many such mappings. You just have to formulate one
that suits you best. @JohnB’s proposition seems to be the most
reasonable in that regard, however it requires conversion from RGB
(sRGB?) to HSL and back. Algorithms are easy enough to find.