encodeJpgFile function

Future<bool> encodeJpgFile(
  1. String path,
  2. Image image, {
  3. int quality = 100,
  4. JpegChroma chroma = JpegChroma.yuv444,
})

Encode an image to a JPG file at the given path.

Implementation

Future<bool> encodeJpgFile(
  String path,
  Image image, {
  int quality = 100,
  JpegChroma chroma = JpegChroma.yuv444,
}) async {
  if (!supportsFileAccess()) {
    return false;
  }
  final bytes = JpegEncoder(quality: quality).encode(image, chroma: chroma);
  return writeFile(path, bytes);
}