Skip to content

A custom image cropper view library on Android.

License

Notifications You must be signed in to change notification settings

Naitsirc/ImageCropper

 
 

Repository files navigation

ImageCropper

A custom image cropper view library on Android

Features

  • Doesn't need file access permissions
  • Support moving/scale the crop window freely by finger
  • Support rotate the image when cropping
  • Easy to integrate into your app

ScreenShot

Dependency

(1) Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

(2) Add the dependency

allprojects {
    implementation 'com.github.Naitsirc:ImageCropper:-SNAPSHOT'
}

Usage

Use the CropImageView class

import com.naitsirc.imagecropper.CropImageView;

Call these methods to interact with CropImageView

//1. Initialize the CropImageView
private void init() {

    cropImageView = (CropImageView) findViewById(R.id.CropWindow);

    original = BitmapFactory.decodeResource(getResources(), R.drawable.cats);

    cropImageView.initialize(original);

}

//2. Apply the CropImageView events to your layout buttons
public void onClickRotate(View v) {
    cropImageView.rotate();
    cropImageView.invalidate();
}

public void onClickReset(View v) {
    cropImageView.reset();
    cropImageView.invalidate();
}

public void onClickZoom(View v) {
    cropImageView.zoom();
    cropImageView.invalidate();
}

public void onClickCrop(View v) {
    Bitmap x = cropImageView.getCropBitmap();
    cropImageView.initialize(x);
    cropImageView.invalidate();
}

About

A custom image cropper view library on Android.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%