imageResize static method
Implementation
static Uint8List imageResize({required Uint8List bytes, int? maxHeight, int? maxWidth}) {
var imageIsPng = isPng(bytes);
img.Image originalImage = img.decodeImage(bytes)!;
img.Image fixedImage = img.copyResize(interpolation: img.Interpolation.average, originalImage, height: maxHeight, width: maxWidth, maintainAspect: true);
if (imageIsPng) {
return img.encodePng(fixedImage);
} else {
return img.encodeJpg(quality: 75, fixedImage);
}
}