用特殊框架裁剪图片

4

我正在编写一款安卓应用程序。我需要实现类似下图(来自LG的壁纸选择工具)的功能。原始图片没有圆形。

实际图片被裁剪成外部矩形,但缩略图被裁剪成内部圆形。

我想要实现这样的功能,但指南不是矩形,而是圆形。有没有相关示例或库可供使用?

enter image description here

3个回答

9

2

1
请使用这个库: 这个库提供了圆形特性.. 我已经使用这个库实现了圆形裁剪...

https://github.com/MMP-forTour/cropimage

样例代码
private void cropImage(String imagePath) {
    Intent intent = new Intent(context, CropImage.class);
    Log.d("imagepath", "URI= " + imagePath);
    intent.putExtra("image-path", imagePath);
    intent.putExtra("scale", true);
    intent.putExtra("circleCrop",true);  //for circular crop
    intent.putExtra("return-data", false);
    startActivityForResult(intent,REQUEST_CODE_CROP_IMAGE);
 }

另外一个也将图像裁剪成圆形。

https://github.com/biokys/cropimage

https://github.com/lvillani/android-cropimage

https://github.com/dtitov/pickncrop


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接