spdl.io.save_image¶
- save_image(path: str | Path, data: object, pix_fmt: str = 'rgb24', **kwargs)[source]¶
Save the given image tensor.
Note
The current implementation only supports writing data without changing the pixel format. If you need to apply preprocessing including pixel format conversion or rescaling, then construct such pipeline using
FitlerGraph
andMuxer
.- Parameters:
path – The output path
data –
The data to write. The shape must be one of the following and must match the value of
pix_fmt
."rgb24"
,"bgr24"
:(height, width, channel==3)
"gray"
,"gray16be"
:(height, width)
"yuv444p"
:(channel==3, height, width)
If writing
"gray16be"
, the dtype must be 16-bit signed integer. Otherwise it must be 8-bit unsigned integer.pix_fmt – The pixel format used to write data. Supported values are,
"rgb24"
,"bgr24"
,"gray"
,"gray16be"
,"gray16le"
,"gray"
,"yuv444p"
.**kwargs – Extra arguments passed to
video_encode_config()
.