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

[Question] How to get original image quality (e.g. cropping image with half width to give us half of the original image width in pixels) #84

Open
ramtinq opened this issue Mar 9, 2023 · 2 comments

Comments

@ramtinq
Copy link

ramtinq commented Mar 9, 2023

I want to not lose image quality when cropping, so that, for example when someone selects the left half of the image as their crop area, and the original image was 3000x1000 pixels, they would get 1500x1000 pixels as their output, with same quality. Does correctly choosing pixelRatio do the job?

I have seen that one can raise pixelRatio as much as they want, and the output image could have more width and height than the original height.

@ramtinq ramtinq changed the title How to get original image quality (e.g. cropping image with half width to give us half of the original image width in pixels) [Question] How to get original image quality (e.g. cropping image with half width to give us half of the original image width in pixels) Mar 9, 2023
@xclud
Copy link
Owner

xclud commented Mar 9, 2023

Resizing the image is not in the scope of this package. You have to either input a resized image, or resize the output. There are a bunch of packages for Flutter to resize images.

I am closing this issue as it's unrelated. Please feel free to open a new issue any time.

@xclud xclud closed this as completed Mar 9, 2023
@ramtinq
Copy link
Author

ramtinq commented Mar 9, 2023

I don't want to resize image! The package does it!

Just open an image with this package, do no editing at all, get the output from the controller.crop(pixelRatio: MediaQuery.of(context).devicePixelRatio), the original width and height are changed.

So, of course it depends on setting the right value for pixelRatio and I want to know how can it be calculated so there would be no resolution loss in the output if no cropping has happened (or, naturally, if the image is cropped with half width and full height, the output would have a width of originalImage.width / 2 pixels and the height of originalImage.height pixels.

This question is not unrelated at all!

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

2 participants