Skip to content

imencodeWithMetadata

Image codecsfunctionOpenCV 5.0.0
import { imencodeWithMetadata } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSext, img, metadataTypes, metadata
FUNCTIONimencodeWithMetadata
RETURN TYPEboolean
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Encodes an image into a memory buffer.

The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description.

imencodeWithMetadata(ext: EmbindString, img: Mat, metadataTypes: IntVector, metadata: MatVector, buf: ucharVector, params: IntVector): boolean;
2 available overloads
imencodeWithMetadata(ext: EmbindString, img: Mat, metadataTypes: IntVector, metadata: MatVector, buf: ucharVector): boolean;
imencodeWithMetadata(ext: EmbindString, img: Mat, metadataTypes: IntVector, metadata: MatVector, buf: ucharVector, params: IntVector): boolean;
ext

File extension that defines the output format. Must include a leading period.

img

Image to be compressed.

metadataTypes

Vector with types of metadata chucks stored in metadata to write, see ImageMetadataType.

metadata

Vector of vectors or vector of matrices with chunks of metadata to store into the file

buf

Output destination, filled by the native operation. Output buffer resized to fit the compressed image.

params

Format-specific parameters. See cv::imwrite and cv::ImwriteFlags.

Returns

The boolean result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.