resizeImage static method
Implementation
static List<int> resizeImage(Uint8List bytes,
{int newWidth = 100, int? longestSizeTo}) {
Image image = decodeWithCheck(bytes);
Image thumbnail;
if (longestSizeTo != null) {
if (image.width > image.height) {
thumbnail = copyResize(
image,
width: longestSizeTo,
);
} else {
thumbnail = copyResize(
image,
height: longestSizeTo,
);
}
} else {
thumbnail = copyResize(
image,
width: newWidth,
);
}
var encoded = encodeJpg(thumbnail);
return encoded;
}