imcount
import { imcount } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Returns the number of images inside the given file
The function imcount returns the number of pages in a multi-page image (e.g. TIFF), the number of frames in an animation (e.g. AVIF), and 1 otherwise. If the image cannot be decoded, 0 is returned.
Note: The default flags value was changed from cv::IMREAD_ANYCOLOR to cv::IMREAD_COLOR_BGR for unification. todo: when cv::IMREAD_LOAD_GDAL flag used the return value will be 0 or 1 because OpenCV's GDAL decoder doesn't support multi-page reading yet.
imcount(filename: EmbindString, flags: number): number;2 available overloads
imcount(filename: EmbindString): number;imcount(filename: EmbindString, flags: number): number;filenameName of file to be loaded.
flagsFlag that can take values of cv::ImreadModes, default with cv::IMREAD_COLOR_BGR.
The number 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.