{"id":20958517,"url":"https://github.com/junixapp/matisse","last_synced_at":"2025-05-14T06:32:24.312Z","repository":{"id":37461390,"uuid":"176211598","full_name":"junixapp/Matisse","owner":"junixapp","description":"基于知乎Matisse增强，一行代码实现图片/视频选择，裁剪，微信同款视频录制和拍照，无需权限申请！","archived":false,"fork":false,"pushed_at":"2020-01-04T11:44:53.000Z","size":8996,"stargazers_count":201,"open_issues_count":14,"forks_count":33,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-02T14:02:15.333Z","etag":null,"topics":["camera","cameraview","imagepicker","matisse","pictureselector"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/junixapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-18T05:39:54.000Z","updated_at":"2025-03-27T19:12:04.000Z","dependencies_parsed_at":"2022-09-08T19:21:42.954Z","dependency_job_id":null,"html_url":"https://github.com/junixapp/Matisse","commit_stats":null,"previous_names":["junixapp/matisse"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junixapp%2FMatisse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junixapp%2FMatisse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junixapp%2FMatisse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junixapp%2FMatisse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/junixapp","download_url":"https://codeload.github.com/junixapp/Matisse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254084696,"owners_count":22011924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["camera","cameraview","imagepicker","matisse","pictureselector"],"created_at":"2024-11-19T01:48:01.106Z","updated_at":"2025-05-14T06:32:19.302Z","avatar_url":"https://github.com/junixapp.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## Matisse\n知乎Matisse的增强版，简化了使用，优化了用户体验，功能上集成了[UCrop](https://github.com/Yalantis/uCrop) + [CameraView](https://github.com/CJT2325/CameraView)。\n\n\n## 功能\n- 拍摄照片和视频，或者只拍摄照片，或者只拍视频\n- 支持照片裁剪\n- 自动申请所需所有权限，无需额外操作\n- Matisse本身所有功能\n\n# 预览\n![Image](/screenshot/1.gif)\n![Image](/screenshot/2.gif)\n![Image](/screenshot/3.gif)\n\n\n## 使用\n![Download](https://api.bintray.com/packages/li-xiaojun/jrepo/matisse/images/download.svg)\n```groovy\nimplementation 'com.lxj:matisse:最新版本'\n```\n\n## 如何使用\n最简单一行代码即可调用：\n```java\nMatisse.from(SampleActivity.this)\n    .choose(MimeType.ofAll()) //显示所有文件类型，比如图片和视频，\n    .capture(true)//是否显示拍摄按钮，默认不显示\n    //.capture(true, CaptureMode.All)//是否显示拍摄按钮，可以同时拍视频和图片\n    .isCrop(true)//开启裁剪，默认不开启\n    //.imageEngine(new GlideEngine()) //默认是Glide4.x版本的加载器，如果你用的是Glide4.x，则无需设置\n    //.imageEngine(new Glide3Engine())//如果你用的是Glide3.x版本，请打开这个，Glide3Engine这个类在demo中\n    .forResult(REQUEST_CODE_CHOOSE); //请求码\n```\n直接跳转拍摄界面：\n```java\nMatisse.from(SampleActivity.this)\n    .jumpCapture()//直接跳拍摄，默认可以同时拍摄照片和视频\n    //.jumpCapture(CaptureMode.Image)//只拍照片\n    //.jumpCapture(CaptureMode.Video)//只拍视频\n    .isCrop(true) //开启裁剪\n    .forResult(REQUEST_CODE_CHOOSE);\n```\n详细设置：\n```java\nMatisse.from(SampleActivity.this)\n    .choose(MimeType.ofAll())\n    .capture(true) //默认只能拍照片\n    //.capture(true, CaptureMode.All)//通过CaptureMode控制拍照照片还是视频，或者都拍\n    .maxSelectable(9) //默认最大选中9张，设置为1就是单选\n    .theme(R.style.Matisse_Dracula)//暗色主题\n    //添加图片过滤器，比如过滤掉小于10K的图片\n    .addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K))\n    //设置选中图片的监听器\n    .setOnSelectedListener(new OnSelectedListener() {\n        @Override\n        public void onSelected(\n                @NonNull List\u003cUri\u003e uriList, @NonNull List\u003cString\u003e pathList) {\n            // DO SOMETHING IMMEDIATELY HERE\n            Log.e(\"onSelected\", \"onSelected: pathList=\" + pathList);\n\n        }\n    })\n    .originalEnable(true)//是否显示原图，默认显示\n    //设置原图选中和取消选中的监听器\n    .setOnCheckedListener(new OnCheckedListener() {\n        @Override\n        public void onCheck(boolean isChecked) {\n            // DO SOMETHING IMMEDIATELY HERE\n            Log.e(\"isChecked\", \"onCheck: isChecked=\" + isChecked);\n        }\n    })\n    //.imageEngine(new GlideEngine()) // 默认是Glide4.x版本的加载器，如果你用的是Glide4.x，则无需设置\n    //.imageEngine(new Glide3Engine())//如果你用的是Glide3.x版本，Glide3Engine这个类在demo中\n    //.imageEngine(new PicassoEngine())//如果你用的是Picasso\n    .forResult(REQUEST_CODE_CHOOSE); //请求码\n```\n\n#### 接收结果\n\n```java\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n    super.onActivityResult(requestCode, resultCode, data);\n    if (requestCode == REQUEST_CODE_CHOOSE \u0026\u0026 resultCode == RESULT_OK) {\n        //获取拍摄的图片路径，如果是录制视频则是视频的第一帧图片路径\n        String captureImagePath = Matisse.obtainCaptureImageResult(data);\n\n        //获取拍摄的视频路径\n        String captureVideoPath = Matisse.obtainCaptureVideoResult(data);\n\n        //获取裁剪结果的路径，不管是选择照片裁剪还是拍摄照片裁剪，结果都从这里取\n        String cropPath = Matisse.obtainCropResult(data);\n\n        //获取选择图片或者视频的结果路径，如果开启裁剪的话，获取的是原图的地址\n        Matisse.obtainSelectUriResult(data);//uri形式的路径\n        Matisse.obtainSelectPathResult(data)//文件形式路径\n    }\n}\n```\n\n## 混淆\n如果你使用Picasso：\n```pro\n-dontwarn com.squareup.picasso.**\n```\n\n如果你使用Glide：\n```pro\n-dontwarn com.bumptech.glide.**\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunixapp%2Fmatisse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjunixapp%2Fmatisse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunixapp%2Fmatisse/lists"}