DjamesSuhanko / EasyColor

Multiplatform library to convert color formats
GNU General Public License v3.0
2 stars 2 forks source link

HSV to RBG not converting correctly #3

Open ty8447 opened 2 years ago

ty8447 commented 2 years ago

When converting from RGB to HSV, the values are calculated correctly, but when taking those numbers and plugging it back to convert to RGB the values are incorrect.

ghost commented 2 years ago

I can confirm. RGB values seems to be too heavy on the blue side.

DjamesSuhanko commented 2 years ago

Let me take a look on that. Thanks to comments.

ty8447 commented 2 years ago

@DjamesSuhanko The problem is that your math to convert from HSV to RGB is incorrect. I changed it in the code on here and submitted for approval way back in November or something.

ty8447 commented 2 years ago

@DjamesSuhanko I guess that I make a fork of this to fix the issue. Check it out here and see the change I made https://github.com/ty8447/EasyColor.

ghost commented 2 years ago

@ty8447 I will test soon. Hoping it helps!

karl500 commented 1 year ago

The problem is in EasyColor.cpp line 41 : float x = c * (1 - fabsf (fmod ((in.h / HUE_ANGLE), 2) - 1)); HUE_ANGLE is defined as 360, but for this function it should be 60. So the correct line should be: float x = c * (1 - fabsf (fmod ((in.h / 60), 2) - 1));