# pydicom.pixels.convert_color_space

pydicom.pixels.convert_color_space(arr: ndarray, current: str, desired: str, per_frame: bool = False) → ndarray

  Convert the image(s) in arr from one color space to another.

  Changed in version 2.2: Added per_frame keyword parameter.

  Parameters:

    - arr (numpy.ndarray) – The image(s) as `numpy.ndarray` with `shape` (frames, rows, columns, 3) or (rows, columns, 3) and a ‘uint8’ `dtype` (unsigned 8-bit).

    - current (str) – The current color space, should be a valid value for (0028,0004) Photometric Interpretation. One of `'RGB'`, `'YBR_FULL'`, `'YBR_FULL_422'`.

    - desired (str) – The desired color space, should be a valid value for (0028,0004) Photometric Interpretation. One of `'RGB'`, `'YBR_FULL'`, `'YBR_FULL_422'`.

    - per_frame (bool, optional) – If `True` and the input array contains multiple frames then process each frame individually and update arr in-place to reduce memory usage. Default `False`.

  Returns:

    The image(s) converted to the desired color space. If per_frame is `False` (the default) then a new `ndarray` will be returned, otherwise arr will be updated in-place.

  Return type:

    numpy.ndarray

  References

  - DICOM Standard, Part 3, Annex C.7.6.3.1.2

  - ISO/IEC 10918-5:2012 (ITU T.871), Section 7