resizeToMaxSize function
Implementation
imglib.Image resizeToMaxSize(imglib.Image image, int? maxSize) {
if (maxSize == null) {
return image;
}
if (image.width > maxSize || image.height > maxSize) {
final double scaleFactor = maxSize / max(image.width, image.height);
image =
imglib.copyResize(image, width: (image.width * scaleFactor).toInt());
}
return image;
}