resizeRawImage function

Future<List<int>> resizeRawImage(
  1. List<int> rawBytes,
  2. int width,
  3. int height
)

Resizes a raw image byte array to the specified dimensions.

Parameters:

  • rawBytes: The source image data as a list of bytes
  • width: The target width in pixels
  • height: The target height in pixels

Returns a Future that completes with the resized image data as a list of bytes.

Implementation

Future<List<int>> resizeRawImage(List<int> rawBytes, int width, int height) async {
  final codec = await instantiateImageCodec(
    Uint8List.fromList(rawBytes),
    targetWidth: width,
    targetHeight: height
  );
  return encodePng((await codec.getNextFrame()).image);
}