Function: color-lab-to-xyz

color-lab-to-xyz is a byte-compiled function defined in color.el.gz.

Signature

(color-lab-to-xyz L A B &optional WHITE-POINT)

Documentation

Convert CIE L*a*b* to CIE XYZ.

WHITE-POINT specifies the (X Y Z) white point for the conversion. If omitted or nil, use color-d65-xyz.

Source Code

;; Defined in /usr/src/emacs/lisp/color.el.gz
     (* 200 (- fy fz)))))             ; b

(defun color-lab-to-xyz (L a b &optional white-point)
  "Convert CIE L*a*b* to CIE XYZ.
WHITE-POINT specifies the (X Y Z) white point for the
conversion.  If omitted or nil, use `color-d65-xyz'."
  (pcase-let* ((`(,Xr ,Yr ,Zr) (or white-point color-d65-xyz))
               (fy (/ (+ L 16) 116.0))
             (fz (- fy (/ b 200.0)))
             (fx (+ (/ a 500.0) fy))
             (xr (if (> (expt fx 3.0) color-cie-ε)
                     (expt fx 3.0)
               (/ (- (* fx 116) 16) color-cie-κ)))
             (yr (if (> L (* color-cie-κ color-cie-ε))
                     (expt (/ (+ L 16) 116.0) 3.0)
                   (/ L color-cie-κ)))
             (zr (if (> (expt fz 3) color-cie-ε)
                     (expt fz 3.0)
                   (/ (- (* 116 fz) 16) color-cie-κ))))
        (list (* xr Xr)                 ; X
              (* yr Yr)                 ; Y
          (* zr Zr))))                ; Z