• Stars
    star
    133
  • Rank 272,600 (Top 6 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Image Cropper for Android Jetpack Compose.

Cropify

JitPack Vital
Lightweight image cropper for Android Jetpack Compose.

sample.mov

Installation

  1. Add the JitPack repository to your root build.gradle.
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
  1. Add the dependency.
dependencies {
  implementation 'com.github.moyuruaizawa:cropify:${cropifyVersion}'
}

Usage

Bitmap

val state = rememberCropifyState()

Cropify(
  bitmap = imageResource(R.drawable.bitmap),
  state = state,
  onImageCropped = {},
)

Uri

val state = rememberCropifyState()

Cropify(
  uri = imageUri,
  state = state,
  onImageCropped = {},
  onFailedToLoadImage = {}
)

Invoke CropifyState#crop, the cropped image will be passed to onImageCropped. If loading an image from Uri fails, onFailedToLoadImage will be called.

Features

  • Cropping.
  • set Bitmap or load android.net.Uri.
  • Bitmap memory optimization.
  • API Level 21+.

Customizations

  • Cropping frame color.
  • Cropping frame alpha.
  • Cropping frame stroke width.
  • Cropping frame aspect ratio.
  • Grid line color.
  • Grid line alpha.
  • Grid line stroke width.
  • Mask (outside of cropping frame) color.
  • Mask alpha.
  • Background color.

Acknowledgement

I would like to thank ArthurHub/Android-Image-Cropper.
Cropify aims to a Jetpack Compose implementation of ArthurHub/Android-Image-Cropper.