
Enables seamless image cropping with a customizable API, leveraging Coil for efficient image loading and Compose framework for reactive, declarative UIs across platforms.
Welcome to Krop, a Kotlin Multiplatform library for cropping images, built on top of Coil. Whether you're targeting Android, iOS, web, or desktop, this library provides an easy-to-use API to customize and implement image cropping across platforms using Compose Multiplatform.
With Krop, you can seamlessly integrate image cropping functionality into your Kotlin applications, allowing users to interact with images in a native-like manner, regardless of the platform.
Krop works across Android, iOS, web, and desktop with the power of Kotlin Multiplatform and Compose.The table below outlines the compatibility between different versions of the Krop library, Kotlin, and Coil. This ensures you can easily find the correct versions to use together in your project.
| Krop Version | Kotlin Version | Coil Version |
|---|---|---|
| 1.0.x | 2.0.10+ | 3.0.0-alpha05+ |
PNG, JPEG, WEBP
Add the following dependency to your build.gradle.kts, supporting Android, iOS, web, and desktop:
implementation("io.keeppro.krop:krop:1.0.2")To integrate Krop into your project, Wrapping an AsyncImage with Croppable and CroppableState is all you need to get started. Here's a simple example of how you can use Krop in your Compose code:
val croppableState = rememberCroppableState(contentScale = ContentScale.Crop)
Croppable(
state = croppableState,
cropHint = CropHint.Default,
) {
AsyncImage(
model = imageRequest,
contentDescription = null,
imageLoader = loader,
contentScale = ContentScale.Inside,
onSuccess = { croppableState.prepareImage(it.result.image) },
)
}Then you can call croppableState.crop() to get the cropped image.
CroppableState is also responsible for setting ContentScale, beware that you have to set AsyncImage ContentScale.Inside to make things work. And set the expected image size(width, height) at Croppable.
You can also customize the cropping area by setting the aspect ratio to Croppable, or enabling tap and scale of doubleTap and more.
Check out the example project to see how you can integrate Krop into your application across platforms.
This project is licensed under the MIT License. See the LICENSE file for details.
This library is already powering production applications! Check out KeepPro, a queue management app built using Krop to gain simple cropping feature.
If you're using Krop in your project, we'd love to hear from you! Feel free to open a PR and add your app to this showcase.
Welcome to Krop, a Kotlin Multiplatform library for cropping images, built on top of Coil. Whether you're targeting Android, iOS, web, or desktop, this library provides an easy-to-use API to customize and implement image cropping across platforms using Compose Multiplatform.
With Krop, you can seamlessly integrate image cropping functionality into your Kotlin applications, allowing users to interact with images in a native-like manner, regardless of the platform.
Krop works across Android, iOS, web, and desktop with the power of Kotlin Multiplatform and Compose.The table below outlines the compatibility between different versions of the Krop library, Kotlin, and Coil. This ensures you can easily find the correct versions to use together in your project.
| Krop Version | Kotlin Version | Coil Version |
|---|---|---|
| 1.0.x | 2.0.10+ | 3.0.0-alpha05+ |
PNG, JPEG, WEBP
Add the following dependency to your build.gradle.kts, supporting Android, iOS, web, and desktop:
implementation("io.keeppro.krop:krop:1.0.2")To integrate Krop into your project, Wrapping an AsyncImage with Croppable and CroppableState is all you need to get started. Here's a simple example of how you can use Krop in your Compose code:
val croppableState = rememberCroppableState(contentScale = ContentScale.Crop)
Croppable(
state = croppableState,
cropHint = CropHint.Default,
) {
AsyncImage(
model = imageRequest,
contentDescription = null,
imageLoader = loader,
contentScale = ContentScale.Inside,
onSuccess = { croppableState.prepareImage(it.result.image) },
)
}Then you can call croppableState.crop() to get the cropped image.
CroppableState is also responsible for setting ContentScale, beware that you have to set AsyncImage ContentScale.Inside to make things work. And set the expected image size(width, height) at Croppable.
You can also customize the cropping area by setting the aspect ratio to Croppable, or enabling tap and scale of doubleTap and more.
Check out the example project to see how you can integrate Krop into your application across platforms.
This project is licensed under the MIT License. See the LICENSE file for details.
This library is already powering production applications! Check out KeepPro, a queue management app built using Krop to gain simple cropping feature.
If you're using Krop in your project, we'd love to hear from you! Feel free to open a PR and add your app to this showcase.