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

Option to choose only one crop mode. #3

Open
gaurava-mishra opened this issue Aug 21, 2023 · 4 comments
Open

Option to choose only one crop mode. #3

gaurava-mishra opened this issue Aug 21, 2023 · 4 comments

Comments

@gaurava-mishra
Copy link

Hello,
This is not an issue, but a possibile feature that could be widely used.

I am working an application that need final image to be scaled in 512x512 ( i.e. square with custome pixel value).

I could able to use this library though, but app will crash if user select some other crop option rather than square like 16:9, 4:3 5:4 etc.

I have working experience with uCrop earlier, and I knew that uCrop provides options to retrict the user to crop in any particular ratio.
I think, you guys doing good job to combine picker and cropper in a single frame.
Could you also consider this feature request?

@Andrew0000
Copy link
Owner

Andrew0000 commented Aug 22, 2023

Hello @gaurava-mishra,

If I understand you correctly, 512px is the upper limit and it's ok if an image is smaller than 512px. I just added the ability to restrict the possible aspect ratio: strictAspectRatio in ImageTransformation. So if my guess is correct, you will be able to restrict the request like this:

PickRequest(
    source = ...,
    transformation = ImageTransformation(
        maxSidePx = 512,
        strictAspectRatio = AspectRatioIPP("1:1", 1f, 1f),
    ),
)

Please update the dependency version to 1.0.3 and try it.

@gaurava-mishra
Copy link
Author

gaurava-mishra commented Aug 22, 2023 via email

@gaurava-mishra
Copy link
Author

I have checked it and it is working fine. One more this we could notice,
Let say if an user wants to load image having its requirement to be minimum 512 px (in 1:1) cropper.

Could you please add minSidePx in this library?

@Andrew0000
Copy link
Owner

Let me break your question into possible stages:

  • Limit the ability to choose an image with the wrong size in the system's picker. I'm not sure if the system picker provides this ability.
  • Limit the ability to crop an image on the cropping stage. Is that what you need? What if a user already picked an image smaller than required?
  • Upscale the final image if it's smaller than required. I believe it's not a good option.

So basically at this point I don't see the reliable solution. As far as I know we cannot prevent user from picking small images from the system. I may be wrong.

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