pyspng.load¶
-
pyspng.load(data: bytes, format: Optional[str] = None) → numpy.ndarray¶ Load a PNG from a bytes object and return the image data as a np.ndarray.
The output format, if specified, can be one of “L”, “LA”, “RGB”, “RGBA”. If left unspecified, automatically determine it by looking at the PNG ihdr block.
- Parameters
- Returns
Image data as a numpy array.
The resulting array will have shape [height,width,channels] if channels > 1, or [height,width] for grayscale images.
The array dtype is either
np.uint8ornp.uint16, depending the desired output format, or if unspecified, depending on PNG contents.- Return type