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

Define a minimum output size? #52

Closed
Arvkon opened this issue Apr 22, 2015 · 6 comments
Closed

Define a minimum output size? #52

Arvkon opened this issue Apr 22, 2015 · 6 comments

Comments

@Arvkon
Copy link

Arvkon commented Apr 22, 2015

Instagram photos are 640 x 640 pixels in size. I would like to make this the minimum size that an image can be cropped to. Could you (or anyone) suggest how I might go about achieving this?

@ruslanskorb
Copy link
Owner

ruslanskorb commented May 21, 2015

Hello Arvid,

Sorry for the delay.
I will think about it in the coming weekend.
Currently, you can try to add the following code to this line:

if (boundsSize.width < boundsSize.height) {
    maxScale = MIN(maxScale, boundsSize.width / 640.0);
} else {
    maxScale = MIN(maxScale, boundsSize.height / 640.0);
}

Sincerely,
Ruslan

Update (29/11/2017):

Additionally, you must handle the case where the size of the original image is smaller than the minimum output size.

@Arvkon
Copy link
Author

Arvkon commented May 22, 2015

You, sir, are a gentleman! Your suggestion worked like a charm =)

I made a fork with your code and a minOutputSize property: Arvkon@e590f8a

@Arvkon Arvkon closed this as completed May 22, 2015
@ruslanskorb
Copy link
Owner

😃 👍

@perlasivakrishna
Copy link

How to set Min and Max Zoom in Swift ?

@annjawn
Copy link

annjawn commented Nov 22, 2017

i see that this has still not made into the master. Is there plans to move it?

@ruslanskorb
Copy link
Owner

No. There aren't.

You should not limit the size of the image when cropping.

Instead of this, to get an image with the specific minimum size you need to use RSKImageCropper to crop the original image and then if needed manually scale the cropped image up to the minimum output size. This will allow the user to select any desired part of the image.

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