saveWebpAsTrayImage method

Future<String> saveWebpAsTrayImage(
  1. String webpPath
)

Converts the webp at webpPath to tray image png

Saves it in same folder

Implementation

Future<String> saveWebpAsTrayImage(String webpPath) async {
  Uint8List bytes = File(webpPath).readAsBytesSync();
  // Compress to jpg because png does not compress
  Uint8List pngBytes = await _fileService.compressFileTo(
    bytes,
    45000,
    CompressFormat.jpeg,
  );
  String pngPath = '${withoutExtension(webpPath)}.png';
  return await _fileService.saveBytesToFile(pngBytes, pngPath);
}