encodeWith method
Future<Uint8List>
encodeWith(
- ParallelRunner runner,
- Image input, {
- EncodeOptions? encodeOptions,
Encodes input, offering runner the parts that can run independently.
The bytes match encode's exactly, so passing a runner can only make encoding faster, never different. JPEG, JPEG XL, PNG, and WebP use it for sufficiently large independent phases. Lightweight or stateful formats accept a runner but encode inline when spreading work would be slower.
Implementation
Future<Uint8List> encodeWith(ParallelRunner runner, Image input, {EncodeOptions? encodeOptions}) async {
try {
return await encodeImageWith(runner, input, encodeOptions: encodeOptions);
} on ImageCodecException {
rethrow;
} on ArgumentError {
rethrow;
} on Object catch (error) {
throw ImageCodecException('Could not encode the ${format.name} image', cause: error);
}
}