Open Kalyanb447-github opened 3 years ago
@hnvn I am also facing the same issue. Thank you in advance for any quick solution.
@hnvn @kaushalsitapara I noticed the quality loss is happening with Android, not in iOS.
I was checking the Native android code https://github.com/Yalantis/uCrop/issues/384. Few discussions are going on there also.
Will this help if do set in native options.setMaxBitmapSize(10000);
. If yes, can we keep some option to pass maxBitmapSize to the native?
I'm also facing the same issue... any news?
same. at 100 quality is noticeably worse than the source image. experiencing on android, haven't tested on ios yet.
My objective was to reduce the disk size of image. Cropping was reducing disk size quite alright but with poor quality output. My previous code with reduced image quality is as follows:
Future<void> _pickAndCropImage(ImageSource source) async {
File? cropped;
final XFile? image = await picker.pickImage(source: source);
if (image != null) {
cropped = await ImageCropper.cropImage(
sourcePath: image.path, maxHeight: 400, maxWidth: 400, compressQuality: 50%);
}
setState(() {
_imageFile = cropped ?? _imageFile;
});
}
When I moved the quality reduction parameter from cropper to image picker, I got the image disk size reduced without compromising quality. In fact I wanted the disk size to be less than 500kb, so I used another compression package to further reduce the size if the size of resulting image from image.picker is above 500kb. Here's the function I used to achieve that.
Future<void> _pickAndCropImage(ImageSource source) async {
File? result, cropped;
final image = await picker.pickImage(source: source, imageQuality: 50);
final bytes = await image!.readAsBytes();
final kb = bytes.lengthInBytes / 1024;
if (kb > 500) {
final directory = await getApplicationDocumentsDirectory();
result = await FlutterImageCompress.compressAndGetFile(
image.path, '${directory.path}/flutter2.jpg',
quality: 20);
}
if (result != null) {
cropped = await ImageCropper.cropImage(sourcePath: result.path);
}
setState(() {
_imageFile = cropped ?? _imageFile;
});
}
We notice this issue also for web, using compression jpg and compressQuality 100 on high quality images, when zooming out it reduces the image quality drastically. @hnvn any idea how to fix this?
having the same issue. @hnvn is there a fix yet
@hnvn I was able to reproduce the same problem in croppie.js 2.6.5 Here is the jsFiddle https://jsfiddle.net/opheliagame/6m0pw4xq/12/ croppie.js 2.4.1 seems to work as intended
quality is reducing still i selected 100 please fix it out ;(