_pyspng_c.spng_decode_image_bytes¶
-
_pyspng_c.spng_decode_image_bytes(data: bytes, fmt: _pyspng_c.spng_format) → numpy.ndarray¶ Decode PNG bytes into a numpy array.
Note
Single-channel data is returned with shape [h,w,1] instead of [h,w] for simplicity. Use arr[:,:,0] to drop the extra dimension if you want PIL.Image compatible shapes.
- Parameters
data (bytes) – PNG file contents in memory.
fmt – Output format. SPNG_FMT_AUTO will auto-detect the output format based on PNG contents.
- Returns
Image pixel data in shape (height, width, nc).
- Return type