docs: def rgb_to_hsl_hsv(a, isHSV=True):
      """
      Converts RGB image data to HSV or HSL.
      :param a: 3D array. Retval of numpy.asarray(Image.open(...), int)
      :param isHSV: True = HSV, False = HSL
      :return: H,S,L or H,S,V array
      """
      R, G, B = a.T
  
      m = np.min(a, 1).T
      M = np.max(a, 1).T
  
      C = M - m #chroma
      Cmsk = C != 0
  
      # Hue
      H = np.zeros(R.shape, int)
      mask = (M == R) & Cmsk
      H[mask] = np.mod(60 * (G[mask] - B[mask]) / C[mask], 360)
      mask = (M == G) & Cmsk
      H[mask] = (60 * (B[mask] - R[mask]) / C[mask] + 120)
      mask = (M == B) & Cmsk
      H[mask] = (60 * (R[mask] - G[mask]) / C[mask] + 240)
      H *= 255
      H /= 360 # if you prefer, leave as 0-360, but don't convert to uint8
  
  
      # Saturation
      S = np.zeros(R.shape, int)
  
      if isHSV:
          # This code is for HSV:
          # Value
          V = M
  
          # Saturation
          S[Cmsk] = ((255 * C[Cmsk]) / V[Cmsk])
          # H, S, and V are now defined as integers 0-255
          return np.array((H.swapaxes(0, 1), S.swapaxes(0, 1), V.swapaxes(0, 1))).T
      else:
          # This code is for HSL:
          # Value
          L = 0.5 * (M + m)
  
          # Saturation
          S[Cmsk] = ((C[Cmsk]) / (1 - np.absolute(2 * L[Cmsk]/255.0 - 1)))
          # H, S, and L are now defined as integers 0-255
          return np.array((H.swapaxes(0, 1), S.swapaxes(0, 1), L.swapaxes(0, 1))).T