numpy_to_png#

numpy_to_png(array: ndarray) str[source]#

Get a PNG string from a Numpy array.

Parameters

array (ndarray) – A Numpy array of shape (w, h, 3) or (w, h), where the former is meant to become a three-channel image and the latter a one-channel image. The dtype of the array should be uint8.

Returns

str

Return type

str