Description
Android library to choose image from gallery or camera with option to compress result image.
ImagePicker alternatives and similar packages
Based on the "Camera" category.
Alternatively, view ImagePicker alternatives based on common mentions on social networks and blogs.
-
Pix (WhatsApp Style Image Picker)
Pix is a Whatsapp image picker replica. with this, you can integrate an image picker just like WhatsApp. -
LiveEdgeDetection
LiveEdgeDetection is an Android document detection library built on top of OpenCV. It scans documents from camera live mode and allows you to adjust crop using the detected 4 edges and performs perspective transformation of the cropped image. It works best with a dark background. -
MagicalCamera
A library to take picture easy, transform your data in different format and save photos in your device -
Camera
📸 Use Android camera to take pictures and videos, based on `camera2` api. -
HiddenCamera
📸 A library that allows you to capture images in background without displaying UI. -
Heart-Rate-Ometer
Measures human heart rate using camera and flash light. -
Instagram ImagePicker
Instagram like Image Picker for Android
WorkOS - The modern identity platform for B2B SaaS
Do you think we are missing an alternative of ImagePicker or a related project?
README
ImagePicker
Android library to choose image from gallery or camera with option to compress result image.
Download
Add this to your project's build.gradle
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
And add this to your module's build.gradle
dependencies {
implementation 'com.github.maayyaannkk:ImagePicker:x.y.z'
}
Usage
For full example, please refer to app
module
No need to request for write external storage permission, library will do that.
Crop with 1:1 aspect ratio
Start image picker activity
The simplest way to start is setup options and start the activity. Set the FLAG_CROP to crop resulting image in 1:1 aspect ratio
Intent intent = new Intent(this, ImageSelectActivity.class);
intent.putExtra(ImageSelectActivity.FLAG_COMPRESS, false);//default is true
intent.putExtra(ImageSelectActivity.FLAG_CAMERA, true);//default is true
intent.putExtra(ImageSelectActivity.FLAG_GALLERY, true);//default is true
intent.putExtra(ImageSelectActivity.FLAG_CROP, isCrop);//default is false
startActivityForResult(intent, 1213);
Receive result
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1213 && resultCode == Activity.RESULT_OK) {
String filePath = data.getStringExtra(ImageSelectActivity.RESULT_FILE_PATH);
Bitmap selectedImage = BitmapFactory.decodeFile(filePath);
imageView.setImageBitmap(selectedImage);
}
}
Corner cases
throws IllegalStateException if:
-chooseFromCamera and chooseFromGallery both are false