All Projects → ArthurHub → Android Image Cropper

ArthurHub / Android Image Cropper

Licence: apache-2.0
Image Cropping Library for Android, optimized for Camera / Gallery.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Image Cropper

xcrop
Mobile image cropping component - Vue React 移动端裁剪组件
Stars: ✭ 27 (-99.55%)
Mutual labels:  cropper
pikaso
Seamless and headless HTML5 Canvas library
Stars: ✭ 23 (-99.61%)
Mutual labels:  cropper
Wx Cropper
✂️ 微信小程序 图片裁剪工具,简单易用
Stars: ✭ 323 (-94.58%)
Mutual labels:  cropper
vcrop
A simple Vue image cropping component.
Stars: ✭ 14 (-99.76%)
Mutual labels:  cropper
image-cropper
💯一款功能强大的微信小程序图片裁剪插件
Stars: ✭ 1,123 (-81.14%)
Mutual labels:  cropper
Vue Advanced Cropper
The advanced vue cropper library that gives you opportunity to create your own croppers suited for any website design
Stars: ✭ 281 (-95.28%)
Mutual labels:  cropper
avatarcropper
Simple quick avatar cropper!
Stars: ✭ 45 (-99.24%)
Mutual labels:  cropper
Cc
一个基于angular5.0.0+ng-bootstrap1.0.0-beta.8+bootstrap4.0.0-beta.2+scss的后台管理系统界面(没基础的同学请先自学基础,谢谢!)
Stars: ✭ 416 (-93.01%)
Mutual labels:  cropper
cropper
基于vue的图片裁剪组件 支持vue 2.0
Stars: ✭ 44 (-99.26%)
Mutual labels:  cropper
Cropme
Extremely Smooth and Easy Cropping library for you
Stars: ✭ 306 (-94.86%)
Mutual labels:  cropper
Cropper
Android Library for cropping an image at ease.
Stars: ✭ 21 (-99.65%)
Mutual labels:  cropper
vue-pic-clip
一个简单的移动端裁剪图片上传插件
Stars: ✭ 30 (-99.5%)
Mutual labels:  cropper
Simple Crop
全网唯一支持裁剪图片任意角度旋转、交互体验媲美原生客户端的全平台图片裁剪组件。
Stars: ✭ 294 (-95.06%)
Mutual labels:  cropper
ngx-cropper
An Angular image plugin, includes upload, cropper, save to server.
Stars: ✭ 14 (-99.76%)
Mutual labels:  cropper
Vue Avatar Cropper
👧 A simple and elegant avatar cropping and upload plugin.
Stars: ✭ 398 (-93.32%)
Mutual labels:  cropper
react-drop-n-crop
An opinionated implementation of react-dropzone and react-cropper
Stars: ✭ 17 (-99.71%)
Mutual labels:  cropper
Vue Cropper
A simple picture clipping plugin for vue
Stars: ✭ 3,170 (-46.77%)
Mutual labels:  cropper
Jquery Cropper
A jQuery plugin wrapper for Cropper.js.
Stars: ✭ 516 (-91.34%)
Mutual labels:  cropper
Tocropviewcontroller
A view controller for iOS that allows users to crop portions of UIImage objects
Stars: ✭ 4,210 (-29.3%)
Mutual labels:  cropper
Croppr.js
A vanilla JavaScript image cropper that's lightweight, awesome, and has absolutely zero dependencies.
Stars: ✭ 294 (-95.06%)
Mutual labels:  cropper

Android Image Cropper

Android Arsenal Build Status Download

Powerful (Zoom, Rotation, Multi-Source), customizable (Shape, Limits, Style), optimized (Async, Sampling, Matrix) and simple image cropping library for Android.

Crop

Usage

For a working implementation, please have a look at the Sample Project

See GitHub Wiki for more info.

  1. Include the library
dependencies {
    api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
}

Add permissions to manifest

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Add this line to your Proguard config file

-keep class androidx.appcompat.widget.** { *; }

Using Activity

  1. Add CropImageActivity into your AndroidManifest.xml
<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
  android:theme="@style/Base.Theme.AppCompat"/> <!-- optional (needed if default theme has no action bar) -->
  1. Start CropImageActivity using builder pattern from your activity
// start picker to get image for cropping and then use the image in cropping activity
CropImage.activity()
  .setGuidelines(CropImageView.Guidelines.ON)
  .start(this);

// start cropping activity for pre-acquired image saved on the device
CropImage.activity(imageUri)
 .start(this);

// for fragment (DO NOT use `getActivity()`)
CropImage.activity()
  .start(getContext(), this);
  1. Override onActivityResult method in your activity to get crop result
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
    CropImage.ActivityResult result = CropImage.getActivityResult(data);
    if (resultCode == RESULT_OK) {
      Uri resultUri = result.getUri();
    } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
      Exception error = result.getError();
    }
  }
}

Using View

  1. Add CropImageView into your activity
<!-- Image Cropper fill the remaining available height -->
<com.theartofdev.edmodo.cropper.CropImageView
  xmlns:custom="http://schemas.android.com/apk/res-auto"
  android:id="@+id/cropImageView"
  android:layout_width="match_parent"
  android:layout_height="0dp"
  android:layout_weight="1"/>
  1. Set image to crop
cropImageView.setImageUriAsync(uri);
// or (prefer using uri for performance and better user experience)
cropImageView.setImageBitmap(bitmap);
  1. Get cropped image
// subscribe to async event using cropImageView.setOnCropImageCompleteListener(listener)
cropImageView.getCroppedImageAsync();
// or
Bitmap cropped = cropImageView.getCroppedImage();

Features

  • Built-in CropImageActivity.
  • Set cropping image as Bitmap, Resource or Android URI (Gallery, Camera, Dropbox, etc.).
  • Image rotation/flipping during cropping.
  • Auto zoom-in/out to relevant cropping area.
  • Auto rotate bitmap by image Exif data.
  • Set result image min/max limits in pixels.
  • Set initial crop window size/location.
  • Request cropped image resize to specific size.
  • Bitmap memory optimization, OOM handling (should never occur)!
  • API Level 14.
  • More..

Customizations

  • Cropping window shape: Rectangular or Oval (cube/circle by fixing aspect ratio).
  • Cropping window aspect ratio: Free, 1:1, 4:3, 16:9 or Custom.
  • Guidelines appearance: Off / Always On / Show on Toch.
  • Cropping window Border line, border corner and guidelines thickness and color.
  • Cropping background color.

For more information, see the GitHub Wiki.

Posts

Change log

2.8.0

  • Fix crash on Android O (thx @juliooa)
  • Update to support library to AndroidX (thx @mradzinski)
  • Handle failure when selecting non image file (thx @uncledoc)
  • More translations (thx @jkwiecien, @david-serrano)

2.7.0

  • Update gradle wrapper to 4.4
  • Update support library to 27.1.1 and set is statically! (thx @androideveloper)
  • Fix NPE in activity creation by tools (thx @unverbraucht)
  • More translations (thx @gwharvey, @dlackty, @JairoGeek, @shaymargolis)

See full change log.

License

Originally forked from edmodo/cropper.

Copyright 2016, Arthur Teplitzki, 2013, Edmodo, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].