Dart Image Library

Overview
The Dart Image Library provides the ability to load, save, and
manipulate images
in a variety of image file formats.
The library can be used with both dart:io and dart:html, for command-line, Flutter, and
web applications.
NOTE: 4.0 is a major revision from the previous version of the library.
Read/Write
- JPG
- PNG / Animated PNG
- GIF / Animated GIF
- BMP
- TIFF
- TGA
- PVR
- ICO
- WebP / Animated WebP (lossless and lossy)
Read Only
- PSD
- EXR
- PNM (PBM, PGM, PPM)
Write Only
Examples
Create an image, set pixel values, save it to a PNG.
import 'dart:io';
import 'package:image/image.dart' as img;
void main() async {
final image = img.Image(width: 256, height: 256);
for (var pixel in image) {
pixel..r = pixel.x
..g = pixel.y;
}
final png = img.encodePng(image);
await File('image.png').writeAsBytes(png);
}
To asynchronously load an image file, resize it, and save it as a thumbnail:
import 'package:image/image.dart' as img;
void main(List<String> args) async {
final path = args.isNotEmpty ? args[0] : 'test.png';
final cmd = img.Command()
..decodeImageFile(path)
..copyResize(width: 64)
..writeToFile('thumbnail.png');
await cmd.executeThread();
}