hnvn / flutter_image_cropper

A Flutter plugin for Android and iOS supports cropping images
995 stars 392 forks source link

quality is reducing still i selected Quality 100% please fix it out ;( #247

Open Kalyanb447-github opened 3 years ago

Kalyanb447-github commented 3 years ago

quality is reducing still i selected 100 please fix it out ;(

priyabratap commented 3 years ago

@hnvn I am also facing the same issue. Thank you in advance for any quick solution.

priyabratap commented 3 years ago

@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?

EsteveAguilera commented 3 years ago

I'm also facing the same issue... any news?

jam33 commented 3 years ago

same. at 100 quality is noticeably worse than the source image. experiencing on android, haven't tested on ios yet.

ebot64 commented 2 years ago

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;
  });
}
c-seeger commented 1 year ago

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?

anushka-mim commented 11 months ago

having the same issue. @hnvn is there a fix yet

opheliagame commented 11 months ago

@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