Skip to content

Image conversion

Requires NumPy

qimage_to_array returns a NumPy array, and NumPy isn't a dependency of superqt: install it separately.

qimage_to_array

qimage_to_array(img: QImage) -> ndarray

Convert QImage to an array.

Parameters:

  • img (QImage) –

    QImage to be converted.

Returns:

  • arr ( ndarray ) –

    Numpy array of type uint8 and shape (h, w, 4). Index [0, 0] is the upper-left corner of the rendered region.