Skip to content

imencodeanimation

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

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

ARGUMENTSext, animation, buf, params
FUNCTIONimencodeanimation
RETURN TYPEboolean
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Encodes an Animation to a memory buffer.

The function imencodeanimation encodes the provided Animation data into a memory buffer in an animated format. Supported formats depend on the implementation and may include formats like GIF, AVIF, APNG, or WEBP.

imencodeanimation(ext: EmbindString, animation: Animation, buf: ucharVector, params: IntVector): boolean;
2 available overloads
imencodeanimation(ext: EmbindString, animation: Animation, buf: ucharVector): boolean;
imencodeanimation(ext: EmbindString, animation: Animation, buf: ucharVector, params: IntVector): boolean;
ext

The file extension that determines the format of the encoded data.

animation

A constant reference to an Animation struct containing the frames and metadata to be encoded.

buf

Output destination, filled by the native operation. A reference to a vector of unsigned chars where the encoded data will be stored.

params

Optional format-specific parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ...). These parameters are used to specify additional options for the encoding process. Refer to cv::ImwriteFlags for details on possible parameters.

Returns

Returns true if the animation was successfully encoded; returns false otherwise.

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.