pub fn encode_png(rgb: RgbView<'_>) -> Result<Vec<u8>, CvError>Expand description
Encode a packed RGB8 RgbView as a PNG, returning the encoded bytes.
Writes an 8-bit RGB PNG. The view’s stride may exceed width * 3
(padded rows); only the width * 3 leading bytes of each row are written,
so the output is always tightly packed. Lossless: decode_png on the
result recovers the exact RGB samples.
Cold path only. Any encode failure maps to a CvError — never panics.