{"id":16558834,"url":"https://github.com/drjacky/imagepicker","last_synced_at":"2025-04-04T22:07:35.488Z","repository":{"id":37447574,"uuid":"315432863","full_name":"Drjacky/ImagePicker","owner":"Drjacky","description":"📸Image Picker for Android, Pick images from Gallery or Capture a new image with Camera🖼","archived":false,"fork":false,"pushed_at":"2023-05-19T11:15:06.000Z","size":33205,"stargazers_count":236,"open_issues_count":30,"forks_count":58,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T21:07:12.218Z","etag":null,"topics":["android","android-library","camera","compress-image","compress-images","crop-image","image","image-picker","image-picker-android","image-resizer","imagepicker","imageresize","kotlin","kotlin-android"],"latest_commit_sha":null,"homepage":"https://github.com/Drjacky/ImagePicker","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Drjacky.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Drjacky"}},"created_at":"2020-11-23T20:29:05.000Z","updated_at":"2025-02-17T03:16:01.000Z","dependencies_parsed_at":"2024-10-26T20:28:49.823Z","dependency_job_id":"b6ea2e94-6410-4b02-9cb3-d203bc699063","html_url":"https://github.com/Drjacky/ImagePicker","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drjacky%2FImagePicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drjacky%2FImagePicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drjacky%2FImagePicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Drjacky%2FImagePicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Drjacky","download_url":"https://codeload.github.com/Drjacky/ImagePicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256112,"owners_count":20909240,"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":["android","android-library","camera","compress-image","compress-images","crop-image","image","image-picker","image-picker-android","image-resizer","imagepicker","imageresize","kotlin","kotlin-android"],"created_at":"2024-10-11T20:23:51.601Z","updated_at":"2025-04-04T22:07:35.471Z","avatar_url":"https://github.com/Drjacky.png","language":"Kotlin","funding_links":["https://github.com/sponsors/Drjacky"],"categories":[],"sub_categories":[],"readme":"# 📸Image Picker Library for Android\n\n[![Releases](https://img.shields.io/github/release/drjacky/imagePicker/all.svg?style=flat-square)](https://github.com/drjacky/ImagePicker/releases)\n[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=19)\n![Language](https://img.shields.io/badge/language-Kotlin-orange.svg)\n[![PRWelcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Drjacky/ImagePicker/pulls)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FDrjacky%2FImagePicker.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FDrjacky%2FImagePicker?ref=badge_shield)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ImagePicker-green.svg?style=flat)](https://android-arsenal.com/details/1/8208)\n![Language](https://img.shields.io/badge/Kotlin-1.7.21-blue)\n\nEasy to use and configurable library to **Pick an image from the Gallery or Capture image using Camera**. It also allows to **Crop the Image based on Aspect Ratio, Resolution and Image Size**.\n\n## ‍🏍Features\n\n* Pick Gallery Images\n* Pick Images from Google Drive\n* Capture Camera Image\n* Crop Images(Crop image based on provided aspect ratio or let user choose one)\n* Compress Images(Compress image based on provided resolution and size)\n* Retrieve Image Result as File, File Path as String or Uri object\n* Handle Runtime Permission for Camera and Storage\n\n## 🎬Preview\n\n\n   Profile Image Picker    |         Gallery Only      |       Camera Only        |\n:-------------------------:|:-------------------------:|:-------------------------:\n![](https://github.com/Drjacky/ImagePicker/blob/master/art/imagepicker_profile_demo.gif)  |  ![](https://github.com/Drjacky/ImagePicker/blob/master/art/imagepicker_gallery_demo.gif)  |  ![](https://github.com/Drjacky/ImagePicker/blob/master/art/imagepicker_camera_demo.gif)\n\n## 💻Usage\n\n\nGradle dependency:\n\n```groovy\n\tallprojects {\n\t   repositories {\n\t      \tmavenCentral() // For ImagePicker library, this line is enough. Although, it has been published on jitpack as well\n           \tmaven { url \"https://jitpack.io\" }  //Make sure to add this in your project for uCrop - an internal library\n\t   }\n\t}\n```\n\n```groovy\n   implementation 'com.github.Drjacky:ImagePicker:$libVersion'\n```\n\nWhere `$libVersion`\n= [![libVersion](https://img.shields.io/github/release/drjacky/imagePicker/all.svg?style=flat-square)](https://github.com/drjacky/ImagePicker/releases)\n\n## 🎨Customization\n\n**If you want to get the activity result:**\n\n**Kotlin**\n\n```kotlin\n   private val launcher =\n    registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {\n        if (it.resultCode == Activity.RESULT_OK) {\n            val uri = it.data?.data!!\n            // Use the uri to load the image\n            // Only if you are not using crop feature:\n            uri?.let { galleryUri -\u003e\n                contentResolver.takePersistableUriPermission(\n                    uri, Intent.FLAG_GRANT_READ_URI_PERMISSION\n                )\n            }\n            //////////////\n        }\n    }\n```\n\n**Java**\n\n```java\nActivityResultLauncher\u003cIntent\u003e launcher=\n        registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),(ActivityResult result)-\u003e{\n        if(result.getResultCode()==RESULT_OK){\n        Uri uri=result.getData().getData();\n        // Use the uri to load the image\n        }else if(result.getResultCode()==ImagePicker.RESULT_ERROR){\n        // Use ImagePicker.Companion.getError(result.getData()) to show an error\n        }\n        });\n```\n\n**Both Camera and Gallery:**\n\n```kotlin\n    ImagePicker.with(this)\n    //...\n    .provider(ImageProvider.BOTH) //Or bothCameraGallery()\n    .createIntentFromDialog { launcher.launch(it) }\n```\n\n**Crop image:**\n\n```kotlin\n    .crop()\n```\n\n**Crop image with 16:9 aspect ratio:**\n\n```kotlin\n    .crop(16f, 9f)\n```\n\n**Crop square image(e.g for profile):**\n\n```kotlin\n    .cropSquare()    //Crop square image, its same as crop(1f, 1f)\n```\n\n**Oval crop image:**\n\n```kotlin\n    .crop()     \n    .cropOval() //Allow dimmed layer to have a circle inside\n```\n\n**Set Max Width and Height of final image:**\n\n```kotlin\n    .maxResultSize(512, 512, true) //true: Keep Ratio\n```\n\n**Java sample for using `createIntentFromDialog`:**\n\n```java\nImagePicker.Companion.with(this)\n        .crop()\n        .cropOval()\n        .maxResultSize(512,512,true)\n        .provider(ImageProvider.BOTH) //Or bothCameraGallery()\n        .createIntentFromDialog((Function1)(new Function1(){\npublic Object invoke(Object var1){\n        this.invoke((Intent)var1);\n        return Unit.INSTANCE;\n        }\n\npublic final void invoke(@NotNull Intent it){\n        Intrinsics.checkNotNullParameter(it,\"it\");\n        launcher.launch(it);\n        }\n        }));\n```\n\n**If you want just one option(camera or gallery):**\n\n```kotlin\n    launcher.launch(\n       ImagePicker.with(this)\n           //...\n           .cameraOnly() // or galleryOnly()\n           .createIntent()\n    )\n```\n\n**Let the user to resize crop bounds:**\n\n```kotlin\n        .crop()                                                  \n        .cropFreeStyle()\n```\n\n**Let the user to pick multiple files or single file in gallery mode:**\n\n```kotlin\n        .setMultipleAllowed(true)\n```\n\n**Let the user defines the output format:**\n\n```kotlin\n        .setOutputFormat(Bitmap.CompressFormat.WEBP)\n```\n\n**Intercept ImageProvider; could be used for analytics purposes:**\n\n```kotlin\nImagePicker.with(this)\n        .setImageProviderInterceptor { imageProvider -\u003e //Intercept ImageProvider\n            Log.d(\"ImagePicker\", \"Selected ImageProvider: \"+imageProvider.name)\n        }\n        .createIntent()\n```\n\n**Intercept Dialog dismiss event:**\n\n```kotlin\n    ImagePicker.with(this)\n    \t.setDismissListener {\n    \t\t// Handle dismiss event\n    \t\tLog.d(\"ImagePicker\", \"onDismiss\");\n    \t}\n    \t.createIntent()\n```\n\n**Limit MIME types while choosing a gallery image:**\n\n```kotlin\n        .galleryMimeTypes(  //Exclude gif images\n                    mimeTypes = arrayOf(\n                      \"image/png\",\n                      \"image/jpg\",\n                      \"image/jpeg\"\n                    )\n                  )\n```\n\n**Add Following parameters in your **colors.xml** file, if you want to customize uCrop Activity:**\n\n```xml\n    \u003cresources\u003e\n        \u003c!-- Here you can add color of your choice  --\u003e\n        \u003ccolor name=\"ucrop_color_toolbar\"\u003e@color/teal_500\u003c/color\u003e\n        \u003ccolor name=\"ucrop_color_statusbar\"\u003e@color/teal_700\u003c/color\u003e\n        \u003ccolor name=\"ucrop_color_widget_active\"\u003e@color/teal_500\u003c/color\u003e\n    \u003c/resources\u003e\n```\n\n## 💥Compatibility\n\n  * Library - Android Kitkat 4.4+ (API 19)\n  * Sample - Android Kitkat 4.4+ (API 19)\n\n## 📃 Libraries Used\n* uCrop [https://github.com/Yalantis/uCrop](https://github.com/Yalantis/uCrop)\n* Compressor [https://github.com/zetbaitsu/Compressor](https://github.com/zetbaitsu/Compressor)\n* ImagePicker [https://github.com/Dhaval2404/ImagePicker](https://github.com/Dhaval2404/ImagePicker) which my work is based on this repository.\n\n## License\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FDrjacky%2FImagePicker.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FDrjacky%2FImagePicker?ref=badge_large)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrjacky%2Fimagepicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrjacky%2Fimagepicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrjacky%2Fimagepicker/lists"}