diff --git a/MagickCore/gem.c b/MagickCore/gem.c
index 1cd5bad..36fbdf8 100644
--- a/MagickCore/gem.c
+++ b/MagickCore/gem.c
@@ -1342,12 +1342,11 @@
b;
ConvertXYZToLab(X,Y,Z,luma,&a,&b);
- *chroma=hypot(255.0*(a-0.5),255.0*(b-0.5));
- *hue=180.0*atan2(255.0*(b-0.5),255.0*(a-0.5))/MagickPI;
- *chroma=(*chroma)/255.0+0.5;
- *hue=(*hue)/255.0+0.5;
+ *chroma=hypot(255.0*(a-0.5),255.0*(b-0.5))/255.0+0.5;
+ *hue=180.0*atan2(255.0*(b-0.5),255.0*(a-0.5))/MagickPI/360.0;
if (*hue < 0.0)
*hue+=1.0;
+ *hue+=0.5;
}
MagickPrivate void ConvertRGBToLCHab(const double red,const double green,
@@ -1405,12 +1404,11 @@
v;
ConvertXYZToLuv(X,Y,Z,luma,&u,&v);
- *chroma=hypot(354.0*u-134.0,262.0*v-140.0);
- *hue=180.0*atan2(262.0*v-140.0,354.0*u-134.0)/MagickPI;
- *chroma=(*chroma+134.0)/354.0;
- *hue=(*hue+140.0)/262.0;
+ *chroma=(hypot(354.0*u-134.0,262.0*v-140.0)+134.0)/354.0;
+ *hue=180.0*atan2(262.0*v-140.0,354.0*u-134.0)/MagickPI/360.0;
if (*hue < 0.0)
*hue+=1.0;
+ *hue=(255.0**hue+140.0)/262.0;
}
MagickPrivate void ConvertRGBToLCHuv(const double red,const double green,