简体   繁体   中英

Android image cropping from gallery or camera

I want to crop an image which was selected from gallery or camera. I got it but while selecting the crop the square shaped area is not fixed. I want to fix to particular size. This is exactly same as upload of profile pic in whatsapp messenger. for that I have tried this. https://github.com/biokys/cropimage

    Intent intent = new Intent(this, CropImage.class);
    intent.putExtra(CropImage.IMAGE_PATH, mFileTemp.getPath());
    intent.putExtra(CropImage.SCALE, true);
    intent.putExtra(CropImage.OUTPUT_X, 200);
    intent.putExtra(CropImage.OUTPUT_Y, 200);
    intent.putExtra(CropImage.SCALE_UP_IF_NEEDED, true);
    intent.putExtra(CropImage.ASPECT_X, 1);
    intent.putExtra(CropImage.ASPECT_Y, 1);

    startActivityForResult(intent, REQUEST_CODE_CROP_IMAGE);

Finally at the end of the day i got it...in that project( library project ), inside ImageViewTouchBase.java we have to change float max = Math.max(fw, fh) * 16; i changed the denominator value according to my need. that make to succeed in this. such a silly mistakes done ...sometimes it happens...any way i got it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM