]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 19 Apr 2013 20:30:10 +0000 (20:30 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 19 Apr 2013 20:30:10 +0000 (20:30 +0000)
MagickCore/gem.c

index 99df3d45ba479fbf2d1813ea3bb4fe1b3ef871a3..74560707a678b497bc5a4319a094ecaee81e3ff5 100644 (file)
@@ -867,13 +867,13 @@ MagickPrivate void ConvertRGBToLCHab(const double red,const double green,
   assert(hue != (double *) NULL);
   ConvertRGBToXYZ(red,green,blue,&X,&Y,&Z);
   ConvertXYZToLab(X,Y,Z,&L,&a,&b);
-  C=hypot(a,b);
-  H=180.0*atan2(b,a)/MagickPI/360.0;
+  C=hypot(255.0*(a-0.5)/500.0,255.0*(b-0.5)/200.0);
+  H=180.0*atan2(255.0*(b-0.5)/200.0,255.0*(a-0.5)/500.0)/MagickPI/360.0;
   if (H < 0.0)
     H+=1.0;
   if (H >= 1.0)
     H-=1.0;
-  *luma=L;
+  *luma=(100.0*L+16.0)/116.0;
   *chroma=C;
   *hue=H;
 }