encodePngFile function

Future<bool> encodePngFile(
  1. String path,
  2. Image image, {
  3. bool singleFrame = false,
  4. int level = 6,
  5. PngFilter filter = PngFilter.paeth,
})

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

Implementation

Future<bool> encodePngFile(String path, Image image,
    {bool singleFrame = false,
    int level = 6,
    PngFilter filter = PngFilter.paeth}) async {
  if (!supportsFileAccess()) {
    return false;
  }
  final bytes = PngEncoder(level: level, filter: filter)
      .encode(image, singleFrame: singleFrame);
  return writeFile(path, bytes);
}