image_to_webp 1.0.0
image_to_webp: ^1.0.0 copied to clipboard
Convert PNG/JPG images to WebP using a webp.yaml config file (CLI + API).
import 'dart:io';
import 'package:image_to_webp/image_to_webp.dart';
Future<void> main() async {
// For a real project, place this file next to your project `pubspec.yaml`.
//
// Example `webp.yaml`:
//
// paths:
// - assets/* # shallow
// - assets/** # recursive
// quality: 80
final exitCode = await runImageToWebp(
const ['--config', 'webp.yaml'],
stdout: stdout,
stderr: stderr,
);
if (exitCode != 0) {
exit(exitCode);
}
}