decodeImage function

String decodeImage(
  1. CompressObject object
)

Implementation

String decodeImage(CompressObject object) {
  Im.Image? image = Im.decodeImage(object.imageFile.readAsBytesSync());
  Im.Image smallerImage = Im.copyResize(
      image!,width: 200,height: 200
  ); // choose the size here, it will maintain aspect ratio
  var decodedImageFile = File(object.path + '/img_${object.rand}.jpg');
  decodedImageFile.writeAsBytesSync(Im.encodeJpg(smallerImage, quality: 85));
  return decodedImageFile.path;
}