Skip to content

haveImageReader

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

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

ARGUMENTSfilename
FUNCTIONhaveImageReader
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 can be decoded by OpenCV.

The function haveImageReader checks if OpenCV is capable of reading the specified file. This can be useful for verifying support for a given image format before attempting to load an image.

Note: The function checks the availability of image codecs that are either built into OpenCV or dynamically loaded. It does not load the image codec implementation and decode data, but uses signature check. If the file cannot be opened or the format is unsupported, the function will return false.

See: cv::haveImageWriter, cv::imread, cv::imdecode

haveImageReader(filename: EmbindString): boolean;
filename

The name of the file to be checked.

Returns

true if an image reader for the specified file is available and the file can be opened, 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.