Batch processing
Run several image operations in one native or WebAssembly call.
batch() records operations and executes them only when you request an image,
bytes, or a file. This avoids Dart-visible intermediate images.
Encode a batch
final bytes = image
.batch()
.resize(800, 600)
.grayscale()
.encode(PixerJpegEncoder(quality: 85));
Return an image
final result = image
.batch()
.crop(10, 10, 200, 200)
.rotate90()
.toImage();
try {
print('${result.width}x${result.height}');
} finally {
result.dispose();
}
Save a batch
image.batch().resize(320, 240).saveToFile('thumbnail.png');
The original Pixer remains unchanged. Sequence-dependent validation, such as
crop bounds after a resize, is evaluated against the preceding operation’s
output.