All Projects → li-xiaojun → Matisse

li-xiaojun / Matisse

基于知乎Matisse增强,一行代码实现图片/视频选择,裁剪,微信同款视频录制和拍照,无需权限申请!

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Matisse

ProPicker
ProPicker is a file picker (image, video, file) library for Android. It helps you to pick any file and return the result in a convenient way
Stars: ✭ 25 (-85.63%)
Mutual labels:  camera, imagepicker
MJMediaPicker
A Custom Class to select media from camera ,video or photo library by just adding a single file
Stars: ✭ 15 (-91.38%)
Mutual labels:  camera, imagepicker
XGImagePickerController
iOS相册图片/视频选择器
Stars: ✭ 32 (-81.61%)
Mutual labels:  camera, imagepicker
Coco
基于kotlin、简洁易用的调用系统拍照或图片选择库
Stars: ✭ 276 (+58.62%)
Mutual labels:  camera, imagepicker
Ypimagepicker
📸 Instagram-like image picker & filters for iOS
Stars: ✭ 3,661 (+2004.02%)
Mutual labels:  camera, imagepicker
Picker
Picker - A CameraX based WhatsApp Style Image-Video Picker
Stars: ✭ 69 (-60.34%)
Mutual labels:  camera, imagepicker
Imagepicker
📸Image Picker for Android, Pick an image from Gallery or Capture a new image with Camera
Stars: ✭ 623 (+258.05%)
Mutual labels:  camera, imagepicker
Rximagepicker
Android图片相册预览选择器、支持AndroidX,支持图片的单选、多选、图片预览、图片文件夹切换、在选择图片时调用相机拍照
Stars: ✭ 85 (-51.15%)
Mutual labels:  camera, imagepicker
Sony camera api
sony camera remote api
Stars: ✭ 154 (-11.49%)
Mutual labels:  camera
Patches
Patches is a visual programming editor for building WebVR and WebGL experiences.
Stars: ✭ 164 (-5.75%)
Mutual labels:  camera
Smartopencv
🔥 🔥 🔥 SmartOpenCV是一个OpenCV在Android端的增强库,解决了OpenCV Android SDK在图像预览方面存在的诸多问题,且无需修改OpenCV SDK源码,与OpenCV的SDK解耦
Stars: ✭ 1,869 (+974.14%)
Mutual labels:  camera
Qrcodereaderview
Modification of ZXING Barcode Scanner project for easy Android QR-Code detection and AR purposes
Stars: ✭ 1,873 (+976.44%)
Mutual labels:  camera
Opalimagepicker
A multiple image picker for iOS, written in Swift
Stars: ✭ 165 (-5.17%)
Mutual labels:  imagepicker
Mipi csi receiver fpga
MIPI CSI-2 Camera Sensor Receiver verilog HDL implementation For any generic FPGA. Tested with IMX219 on Lattice MachXO3LF. 2Gbps UVC Video Stream Over USB 3.0 with Cypress FX3
Stars: ✭ 154 (-11.49%)
Mutual labels:  camera
Annca
Android library to simplify work with camera for video and photo with using different camera apis.
Stars: ✭ 169 (-2.87%)
Mutual labels:  camera
Mmalsharp
C# wrapper to Broadcom's MMAL with an API to the Raspberry Pi camera.
Stars: ✭ 152 (-12.64%)
Mutual labels:  camera
Sltk
An OpenCV-based structured light processing toolkit.
Stars: ✭ 151 (-13.22%)
Mutual labels:  camera
Alcameraviewcontroller
A camera view controller with custom image picker and image cropping.
Stars: ✭ 2,023 (+1062.64%)
Mutual labels:  camera
Pynet Pytorch
Generating RGB photos from RAW image files with PyNET (PyTorch)
Stars: ✭ 169 (-2.87%)
Mutual labels:  camera
Awesomeimagepicker
Awesome Image Picker library will pick images/gifs with beautiful interface. Supports image or gif, Single and Multiple Image selection.
Stars: ✭ 160 (-8.05%)
Mutual labels:  imagepicker

Matisse

知乎Matisse的增强版,简化了使用,优化了用户体验,功能上集成了UCrop + CameraView

功能

  • 拍摄照片和视频,或者只拍摄照片,或者只拍视频
  • 支持照片裁剪
  • 自动申请所需所有权限,无需额外操作
  • Matisse本身所有功能

预览

Image Image Image

使用

Download

implementation 'com.lxj:matisse:最新版本'

如何使用

最简单一行代码即可调用:

Matisse.from(SampleActivity.this)
    .choose(MimeType.ofAll()) //显示所有文件类型,比如图片和视频,
    .capture(true)//是否显示拍摄按钮,默认不显示
    //.capture(true, CaptureMode.All)//是否显示拍摄按钮,可以同时拍视频和图片
    .isCrop(true)//开启裁剪,默认不开启
    //.imageEngine(new GlideEngine()) //默认是Glide4.x版本的加载器,如果你用的是Glide4.x,则无需设置
    //.imageEngine(new Glide3Engine())//如果你用的是Glide3.x版本,请打开这个,Glide3Engine这个类在demo中
    .forResult(REQUEST_CODE_CHOOSE); //请求码

直接跳转拍摄界面:

Matisse.from(SampleActivity.this)
    .jumpCapture()//直接跳拍摄,默认可以同时拍摄照片和视频
    //.jumpCapture(CaptureMode.Image)//只拍照片
    //.jumpCapture(CaptureMode.Video)//只拍视频
    .isCrop(true) //开启裁剪
    .forResult(REQUEST_CODE_CHOOSE);

详细设置:

Matisse.from(SampleActivity.this)
    .choose(MimeType.ofAll())
    .capture(true) //默认只能拍照片
    //.capture(true, CaptureMode.All)//通过CaptureMode控制拍照照片还是视频,或者都拍
    .maxSelectable(9) //默认最大选中9张,设置为1就是单选
    .theme(R.style.Matisse_Dracula)//暗色主题
    //添加图片过滤器,比如过滤掉小于10K的图片
    .addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K))
    //设置选中图片的监听器
    .setOnSelectedListener(new OnSelectedListener() {
        @Override
        public void onSelected(
                @NonNull List<Uri> uriList, @NonNull List<String> pathList) {
            // DO SOMETHING IMMEDIATELY HERE
            Log.e("onSelected", "onSelected: pathList=" + pathList);

        }
    })
    .originalEnable(true)//是否显示原图,默认显示
    //设置原图选中和取消选中的监听器
    .setOnCheckedListener(new OnCheckedListener() {
        @Override
        public void onCheck(boolean isChecked) {
            // DO SOMETHING IMMEDIATELY HERE
            Log.e("isChecked", "onCheck: isChecked=" + isChecked);
        }
    })
    //.imageEngine(new GlideEngine()) // 默认是Glide4.x版本的加载器,如果你用的是Glide4.x,则无需设置
    //.imageEngine(new Glide3Engine())//如果你用的是Glide3.x版本,Glide3Engine这个类在demo中
    //.imageEngine(new PicassoEngine())//如果你用的是Picasso
    .forResult(REQUEST_CODE_CHOOSE); //请求码

接收结果

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) {
        //获取拍摄的图片路径,如果是录制视频则是视频的第一帧图片路径
        String captureImagePath = Matisse.obtainCaptureImageResult(data);

        //获取拍摄的视频路径
        String captureVideoPath = Matisse.obtainCaptureVideoResult(data);

        //获取裁剪结果的路径,不管是选择照片裁剪还是拍摄照片裁剪,结果都从这里取
        String cropPath = Matisse.obtainCropResult(data);

        //获取选择图片或者视频的结果路径,如果开启裁剪的话,获取的是原图的地址
        Matisse.obtainSelectUriResult(data);//uri形式的路径
        Matisse.obtainSelectPathResult(data)//文件形式路径
    }
}

混淆

如果你使用Picasso:

-dontwarn com.squareup.picasso.**

如果你使用Glide:

-dontwarn com.bumptech.glide.**
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].