Convert colors🔗

Converts encoded images to RGB or grayscale. This tool can be used to convert encoded and compressed image buffers to raw color or grayscale images. Encoded color images are produced e.g. by the Image Source with the autoDecode flag set to false. Compressed images typically come from files (see Read Image file).

This tool is useful in applications where the full RGB data received from a camera is not always needed or if decoding all frames takes too much time. It lets the application developer to move automatic decoding out of the image source and selectively decode color images when needed.


  • image: Any image, usually Bayer or YUV encoded or compressed as JPEG/PNG. The tool also accepts raw RGB and gray-level input and can thus be used with all types of cameras (virtual or real).

  • outputType: Type of the output image.


  • image: Raw RGB or gray-level image.

enum OutputType🔗

Type of the output image.


enumerator Automatic🔗

The type of the output image is the same as the type of the input image.

enumerator Rgb🔗

Output is always an ordinary color RGB image.

enumerator Grayscale🔗

Output is always a grayscale image.

enumerator Rgba🔗

Output is always an RGBA image.

enumerator PremultipliedRgba🔗

Output is always an RGBA image with the alpha channel premultiplied into RGB components.

This makes some blending operations faster.