resizeImage function

Future resizeImage(
  1. dynamic image,
  2. int width,
  3. int height
)

Resizes an Image to the specified dimensions.

Parameters:

  • image: The source Image to resize
  • width: The target width in pixels
  • height: The target height in pixels

Returns a Future that completes with the resized Image.

Implementation

Future<Image> resizeImage(Image image, int width, int height) async {
  final codec = await instantiateImageCodec(
    await encodePng(image),
    targetWidth: width,
    targetHeight: height
  );
  return (await codec.getNextFrame()).image;
}