https://github.com/tanish-ranjan/crop-kit
Crop Kit is a Jetpack Compose library that allows you to easily crop images with customizable crop shapes such as Rectangle, Square, and Circle. It provides a simple yet flexible crop composable to seamlessly integrate into your Android applications. Features include image flipping, rotation, and gridlines to enhance the cropping experience.
https://github.com/tanish-ranjan/crop-kit
android image-cropping image-processing jetpack-compose kotlin library mobile-development open-source
Last synced: about 1 year ago
JSON representation
Crop Kit is a Jetpack Compose library that allows you to easily crop images with customizable crop shapes such as Rectangle, Square, and Circle. It provides a simple yet flexible crop composable to seamlessly integrate into your Android applications. Features include image flipping, rotation, and gridlines to enhance the cropping experience.
- Host: GitHub
- URL: https://github.com/tanish-ranjan/crop-kit
- Owner: Tanish-Ranjan
- License: mit
- Created: 2025-04-06T13:49:58.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-08T21:24:39.000Z (about 1 year ago)
- Last Synced: 2025-04-11T00:59:09.435Z (about 1 year ago)
- Topics: android, image-cropping, image-processing, jetpack-compose, kotlin, library, mobile-development, open-source
- Language: Kotlin
- Homepage:
- Size: 986 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Crop Kit 🏜️
Crop Kit is a Jetpack Compose library that allows you to easily crop images. It provides a simple
yet customizable crop composable to style embed it in your app seamlessly.
## ✨ Features
- Provides three crop shapes: Rectangle, Square, and Circle.
- Allows flipping the image vertically or horizontally.
- Image can be rotated clockwise and anti-clockwise by 90 degrees.
- Gridlines can be enabled or disabled.
## Preview
https://github.com/user-attachments/assets/df19cff9-95fe-415d-bf17-0a8bb4da7a32
## 🚀 Getting Started
1. **Add the JitPack repository to your root build.gradle file:**
Kotlin DSL
```gradle
dependencyResolutionManagement {
...
repositories {
...
maven { setUrl("https://jitpack.io") }
}
}
```
Groovy DSL
```gradle
dependencyResolutionManagement {
...
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
2. **Add the dependency:**
Kotlin DSL
```gradle
dependencies {
implementation("com.github.Tanish-Ranjan:crop-kit:version")
}
```
Groovy DSL
```gradle
dependencies {
implementation 'com.github.Tanish-Ranjan:crop-kit:version'
}
```
3. **Use the Composable:**
```kotlin
@Composable
fun ColumnScope.CropComposable() {
// Create a crop controller and pass it your image bitmap
val cropController = rememberCropController(bitmap = mBitmap)
// Pass the controller to the ImageCropper composable
ImageCropper(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
.padding(24.dp),
cropController = cropController
)
Button(
onClick = {
val croppedBitmap = cropController.crop()
// Handle the croppedBitmap
}
) {
Text("Crop")
}
}
```
See [demo app](/app) for full implementation.
## 🤝 Contributing
We welcome contributions! Please read our [Contributing Guide](CONTRIBUTING.md) for more information
on how to get involved.
## 📄 License
This project is licensed under the [MIT License](LICENSE).