scaleImage method

Future<Image?> scaleImage(
  1. double scale
)

Image scale.

*scale scale image.

Implementation

Future<ui.Image?> scaleImage(double scale) async {
  if (scale == 1.0) return this;
  final bytes = await toPngBytes();
  if (bytes == null) return null;
  final codec = await ui.instantiateImageCodec(
    bytes,
    targetWidth: (width * scale).toInt(),
    targetHeight: (height * scale).toInt(),
  );
  final frameInfo = await codec.getNextFrame();
  final scaleImage = frameInfo.image;
  return scaleImage;
}