imencodeanimation
import { imencodeanimation } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
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;extThe file extension that determines the format of the encoded data.
animationA constant reference to an Animation struct containing the frames and metadata to be encoded.
bufOutput destination, filled by the native operation. A reference to a vector of unsigned chars where the encoded data will be stored.
paramsOptional 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::ImwriteFlagsfor details on possible parameters.
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.