diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c index c8f23426105..e32d1f17096 100644 --- a/src/libImaging/Convert.c +++ b/src/libImaging/Convert.c @@ -311,7 +311,8 @@ rgb2bgr24(UINT8 *out, const UINT8 *in, int xsize) { static void rgb2hsv_row(UINT8 *out, const UINT8 *in) { // following colorsys.py - float h, s, rc, gc, bc, cr; + double h; + float s, rc, gc, bc, cr; UINT8 maxc, minc; UINT8 r, g, b; UINT8 uh, us, uv; @@ -340,6 +341,8 @@ rgb2hsv_row(UINT8 *out, const UINT8 *in) { // following colorsys.py } // incorrect hue happens if h/6 is negative. h = fmod((h / 6.0 + 1.0), 1.0); + //h = h / 6.0 + 1.0; + //h = h - (int)h; uh = (UINT8)CLIP8((int)(h * 255.0)); us = (UINT8)CLIP8((int)(s * 255.0));