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

Set Cropper Minimum Size #46

Open
anuj77 opened this issue Jan 21, 2016 · 9 comments
Open

Set Cropper Minimum Size #46

anuj77 opened this issue Jan 21, 2016 · 9 comments

Comments

@anuj77
Copy link

anuj77 commented Jan 21, 2016

Hello,

Thank you for this amazing cropper code.
I have one requirement where I need to limit the cropper to certain height and width.
I need to set a thumbnail from an image.The image could be tall(1400x600 image resolution from the gallery) or wide(600x1400 image resolution from the gallery), but the thumbnail should be in 4:3 ratio(of image resolution) only.So cropper should be in 4:3 with minimum height and width of 400 x 300.
If a user selects an image is of size 2154x1616, the cropper should let user crop until image size become 400x300.If a user is trying to crop an image even after the image is 400x300, cropper should not let user.
Is there any way in current code to do this?

@TimOliver
Copy link
Owner

Hi @anuj77!

Thanks a lot for that! I'm glad you like the look of my library!

Ummm, not at the moment... The cropper lets you choose a specific aspect ratio to clamp to, but no explicit size limiting yet.

That's definitely a good idea though. I'll leave this issue open to remind me to add that at some point.
If you feel up to it, feel free to try adding it yourself!

@imack
Copy link

imack commented Feb 12, 2016

This is definitely something I could use as well. My biggest issue with PEPhotoCropEditor was a lack of minimum crop support.

@TimOliver
Copy link
Owner

Thanks for the feedback!

I'm still swamped, so I've got no time to look into this myself. Feel free to try it yourself and file a PR! :)

@harishchopra86
Copy link

harishchopra86 commented Sep 27, 2016

Hey @TimOliver ,
Thanks for the amazing cropping code. Did you got chance to implement the minimum image size limit?
Thanks.

@TimOliver
Copy link
Owner

Hi @harishchopra86! Thanks a lot! Glad you're liking it!

Nope, nothing yet sorry! I've been incredibly busy helping my company launch a new thing as of late, so I've only now gotten a chance to start looking at my open source libraries again.

I'm interested in doing this one for the challenge, but there's still a few nitty gritty implementation details to work out:

  • What is required to calculate the minimum size the crop box can be when the user resizes it.
  • What is required to calculate the maximum zoom a user can pinch-in.
  • What happens when the screen rotates.

Honestly, if anyone else wants to try adding it, that would be a huge help. :)

@harishchopra86
Copy link

Hi @TimOliver

I had a look into https://realm.io and it is a revolutionary product. Below are my inline thoughts over the image size implementation points:

What is required to calculate the minimum size the crop box can be when the user resizes it.

  • I think minimising the size of crop box should be allowed until the image's size(height OR width) is greater then the crop box's size. As soon as the image's height OR width reaches cropbox's size then no more resizing should be allowed.

What is required to calculate the maximum zoom a user can pinch-in.

  • Maximum zoom should depend on the quality of the image. While zooming if an image's resolution becomes same as the crop box resolution then zoom should be disabled OR you can provide a constant to set maximum zoom scale.

What happens when the screen rotates.

  • If the screen rotates then image and crop box should get resized but their aspect ratio should remain same.

Regards,
Harish

@TimOliver
Copy link
Owner

Thanks @harishchopra86! Glad you like the look of it! :)

Haha yeah, you're right in all of those points; what I was referring to was the actual code logic necessary to enforce those types of constraints. It shouldn't be much code... but it's all math. XD

@AnubhaTrantor
Copy link

Hi @TimOliver,

I am facing one problem by using this code that is Zoom scale limitation. I want to fix zoom scale because when I zoom my image then it is reduced from actual required image size.

For example :- If I require my image to fit in size 300_450 so I have given crop box with 2:3 aspect ratio and can crop the image in it. But I can keep zooming the image and the zooming is not restricted and at last I get image of very small size like 50_75, etc. So, is there any mechanism by which I can stop image zoom when the image size has reached the minimum size OR Dropbox size. Please advise.

Regards,
Anubha

@Faiyyaz
Copy link

Faiyyaz commented Apr 15, 2019

Hey tim,

Thanks for such a great library.

Even i want this capping feature of minimum resolution.

Please can you let me know if you will update it soon.

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

No branches or pull requests

6 participants