Android-image-cropper: Set Cropping Windows Size Fix

Created on 4 Jul 2017  路  15Comments  路  Source: ArthurHub/Android-Image-Cropper

I read the Wiki and I try to implement the methods which you told but no one work for me I want to make the cropping window as Fix size let suppose 150*50 so how you can achieve it

Most helpful comment

If what you are looking for is to restrict the resulting cropped image to specific size I would suggest using

  .setAspectRatio(3,1)
  .setRequestedSize(150,50, CropImageView.RequestSizeOptions.RESIZE_EXACT)

The aspect ratio will ensure 3-to-1 ratio of the cropped image to ensure resize won't distort the image, and the requested size will resize it to the exact dimenstions.

If for some reason you want to restrict the cropping window to exact size regardless of the image you can use:

  .setMinCropResultSize(150,50)
  .setMaxCropResultSize(150,50)

though the UX will be terrible for large images.

All 15 comments

@kimor79 @cutmail @arriolac @tibbi Please guide me if this is possible using that library i try and read wiki but can not fix

If what you are looking for is to restrict the resulting cropped image to specific size I would suggest using

  .setAspectRatio(3,1)
  .setRequestedSize(150,50, CropImageView.RequestSizeOptions.RESIZE_EXACT)

The aspect ratio will ensure 3-to-1 ratio of the cropped image to ensure resize won't distort the image, and the requested size will resize it to the exact dimenstions.

If for some reason you want to restrict the cropping window to exact size regardless of the image you can use:

  .setMinCropResultSize(150,50)
  .setMaxCropResultSize(150,50)

though the UX will be terrible for large images.

@ArthurHub Thanks for your solution it working fine now

@ArthurHub The above solution is working perfectly for the images which I select from the gallery but it is not working for the images taken from camera

It doesn't really know where the image comes from, it only receives the path to load it.
What is the issue exactly?

It loads the image successfully but the rectangle which I set for the cropping window is very small not able to move properly and however it work perfectly on the image which i load from gallery

@ArthurHub I use below configuration for the two Images

 CropImage.activity()
                .setMinCropResultSize(255,150)
                .setMaxCropResultSize(255,150)
                .start(this);

why the cropping window size is different is it the issue of landscape or protratit mode ?

screenshot_2017-07-17-14-43-27
screenshot_2017-07-17-14-45-07

How Set Cropping Windows Size full screen ?

@asadi1376 my project requirement is to set it to fix size

it's true . Is there a way to Cropping Windows full screen size?

Like I said: "though the UX will be terrible for large images."
What you probably want is the first option I suggested.

The first solution is not working according to my need so what you suggest there is no option for setting the fix cropping windows in your library for any type of images?

What's your goal?
"fix cropping windows" is not a goal by itself, I think you missing the point there.

Otherwise, would love to hear how to handle cropping UX when setting crop window to 1/20 of image size...

My Goal is to restrict the user not to adjust the cropping window size i want to show the user fix cropping window on any type of images

so, you want to show 255x150px crop window on a 3000x3000px image how would that work? It doesn't make sense...

What you should do is set aspect ratio 255x150, let the user select the part of the image he wants. and then resize the result to be exactly 255x150.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PujieWear picture PujieWear  路  5Comments

rahulwadhai picture rahulwadhai  路  5Comments

umutkina picture umutkina  路  4Comments

key321 picture key321  路  9Comments

danponce picture danponce  路  3Comments