An open API service indexing awesome lists of open source software.

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.

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).