imwrite function

bool imwrite(
  1. String filename,
  2. InputArray img, {
  3. VecI32? params,
})

write a Mat to an image file.

For further details, please see: http://docs.opencv.org/master/d4/da8/group__imgcodecs.html#gabbc7ef1aa2edfaa87772f1202d67e0ce

Implementation

bool imwrite(String filename, InputArray img, {VecI32? params}) {
  final fname = filename.toNativeUtf8().cast<ffi.Char>();
  final p = calloc<ffi.Bool>();
  if (params == null) {
    cvRun(() => cimgcodecs.cv_imwrite(fname.cast(), img.ref, p, ffi.nullptr));
  } else {
    cvRun(() => cimgcodecs.cv_imwrite_1(fname.cast(), img.ref, params.ref, p, ffi.nullptr));
  }
  final rval = p.value;
  calloc.free(p);
  return rval;
}