decodeImageFile function
Decodes a PNG/JPEG/BMP image file to an img.Image. Throws
OmrEngineException if it cannot be decoded.
Implementation
img.Image decodeImageFile(String path) {
final decoded = img.decodeImage(File(path).readAsBytesSync());
if (decoded == null) throw OmrEngineException('cannot decode image: $path');
return decoded;
}