Skip to content

haveImageWriter

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

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

ARGUMENTSfilename
FUNCTIONhaveImageWriter
RETURN TYPEboolean
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Checks if the specified image file or specified file extension can be encoded by OpenCV.

The function haveImageWriter checks if OpenCV is capable of writing images with the specified file extension. This can be useful for verifying support for a given image format before attempting to save an image.

Note: The function checks the availability of image codecs that are either built into OpenCV or dynamically loaded. It does not check for the actual existence of the file but rather the ability to write files of the given type.

See: cv::haveImageReader, cv::imwrite, cv::imencode

haveImageWriter(filename: EmbindString): boolean;
filename

The name of the file or the file extension (e.g., ".jpg", ".png"). It is recommended to provide the file extension rather than the full file name.

Returns

true if an image writer for the specified extension is available, 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.