SSImagePicker
Easy to use and configurable library to Pick an image from the Gallery or Capture image using Camera.
- You can easily select image from camera and gallery and upload it wherever you want. We have created this library to simplify pick or capture image feature.
- Handled permissions for camera and gallery, also supports scoped storage.
- Returns contentUri of selected image.
- Easy to use and supports all major devices.
Features :
- Capture Image Using Camera
- Pick Image From Gallery
- Handle Runtime Permission For Storage And Camera
- ImagePicker Bottomsheet
- Retrieve Image Result In Uri Format
- Crop Image
- Rotate Image
- Image Zoom In, Zoom Out
- Customize Image Picker BottomSheet Options Like :
- Customize only text of buttons
- Customize only text color of buttons
- Customize multiple values of buttons like:
- Text color, size, font family, padding using your own styles.xml
- Customize bottomsheet's background shape and color
?Preview
Capture Image Using Camera | Pick Image From Gallery | Customize Bottomsheet |
---|---|---|
![]() |
![]() |
![]() |
Crop Image | Rotate Image | Image Zoom in, Zoom out |
---|---|---|
![]() |
![]() |
![]() |
How it works:
- Gradle Dependency
- Add the JitPack repository to your project's build.gradle file
- Add plugin in your app's build.gradle file
- Add buildFeature in your app's build.gradle file
- Add the dependency in your app's build.gradle file
- Use ImagePicker Bottomsheet To Choose Option For Pick Image From Gallery Or Camera
- Call ImagePickerActivityClass in your onCreate() To Handle Camera, Gallery Click And Permission Result. Pass Context, Activity , Request Permission Result Callback And activityResultRegistry :
- To Enable All Features(crop,rotate,zoomIn,zoomOut) call cropOptions(isAllCropFeaturesRequired: Boolean) And Pass true. By Default It's Set To False And Provides Only Crop Feature.
- Allow Camera And Storage Permission To Pick Image And Send Your onRequestPermissionsResult To ImagePickerActivity
- To Capture Image From Camera Use takePhotoFromCamera()
- To Pick Image From Gallery Use choosePhotoFromGallary()
- Send Your onActivityResult to ImagePickerActivity
- You Will Get Image Result In Uri Format In returnString() And Customize It To Upload
- You can load image in your imageview using loadImage() func. (If you want to apply circleCrop() then pass isCircle = true, by default it's false)
To customize bottomsheet:
- To customize bottomsheet, first override below method in your activity.
- To customize text of buttons in Bottomsheet.
- To only change text color of buttons in Bottomsheet.
- To customize multiple values of buttons (Text color, size, font family, padding), you need to create a style in your style.xml.
In styles.xml (Note: parent must be "Widget.AppCompat.TextView")
Note: if setTextAppearance and setButtonColors both are used than whichever function is last called will override other one.
- To change bottomsheet's background (shape, color).
You need to make one drawable file of type shape.