Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor quality during crop #93

Open
AlexandreKueny opened this issue Aug 12, 2022 · 3 comments
Open

Poor quality during crop #93

AlexandreKueny opened this issue Aug 12, 2022 · 3 comments

Comments

@AlexandreKueny
Copy link

When I take a picture, the image have a good quality, but when I try to use it in Crop, it becomes completely blurry.
Here are two screenshots of the image in the camera and during the Crop:
Capture d’écran 2022-08-12 à 15 37 32
Capture d’écran 2022-08-12 à 15 38 24

This is on emulator (Pixel 4 API 30) but I have the same issue on my physical device (OnePlus 9 Pro).

You can find my code here

@471448446
Copy link

on the demo example/lib/main.dart:

  Future<void> _openImage() async {
    final pickedFile =
        await ImagePicker().pickImage(source: ImageSource.gallery);
    final file = File(pickedFile?.path);
    final sample = await ImageCrop.sampleImage(
      file: file,
      preferredSize: context.size?.longestSide.ceil(),
    );

    _sample?.delete();
    _file?.delete();

    setState(() {
      _sample = sample;
      _file = file;
    });
  }

replace to

  Future<void> _openImage() async {
    final pickedFile =
        await ImagePicker().pickImage(source: ImageSource.gallery);
    final file = File(pickedFile?.path);
    // final sample = await ImageCrop.sampleImage(
    //   file: file,
    //   preferredSize: context.size?.longestSide.ceil(),
    // );
    //
    // _sample?.delete();
    _file?.delete();

    setState(() {
      _sample = file; // direct use origin file
      _file = file;
    });
  }

@LeGoffMael
Copy link

I had the same issue on android, the cropped image were twice smaller than the preferredSize value.

this PR fixed it #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@AlexandreKueny @471448446 @LeGoffMael and others