简体   繁体   English

ImageCropper中圆圈的长宽比

[英]Aspect Ratio for Circle in ImageCropper

I have been working on an app which requires crop image to set aspect ratio of profile picture . 我一直在开发一个需要裁剪图像以设置个人资料图片的纵横比的应用程序。 Right now I have set aspect ratio to (1,1) but it is Square . 现在,我将宽高比设置为(1,1),但是它是Square。 I want a circle cropped image, So please help me to find out what should be the aspect ratio for circle. 我想要一个圆形的图像,所以请帮助我找出圆形的纵横比。 I am using a An Open Source Image Cropper | 我正在使用开源图像裁剪器| Link for Documentation : HERE Keywords; 文档链接: 此处关键字; Android Programming, App developer, Android Studio Android程式设计,应用程式开发人员,Android Studio

CropImage.activity(imageUri)
                .setGuidelines(CropImageView.Guidelines.ON)
                .setAspectRatio(1,1)
                .start(this);

You can't crop an image to be a circle. 您不能将图像裁剪为圆形。 Images must be rectangular. 图片必须为矩形。 What you could do is manually cut out a circle and make the rest transparent. 您可以做的是手动切出一个圆圈并使其余部分透明。

Call the setCropShape() method of ActivityBuilder 调用ActivityBuildersetCropShape()方法

CropImage.activity(imageUri)
         .setCropShape(CropImageView.CropShape.OVAL)
         ...
         .start(this);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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