A simple image cropping library for Android.

Overview

SimpleCropView

build status Android Arsenal Android Gems

The SimpleCropView is an image cropping library for Android.
It simplifies your code for cropping image and provides an easily customizable UI.

Supported on API Level 14 and above.

demo

Table of Contents

Download

Include the following dependency in your build.gradle file. Please use the latest version available.

repositories {
    jcenter()
}
dependencies {
    compile 'com.isseiaoki:simplecropview:1.1.8'
}

Example

Image Cropping

Add permission in AndroidManifest.xml file.

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

Add the com.isseiaoki.simplecropview.CropImageView to your layout XML file.

NOTE: The image is scaled to fit the size of the view by maintaining the aspect ratio. WRAP_CONTENT will be ignored.

<com.isseiaoki.simplecropview.CropImageView
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    android:id="@+id/cropImageView"
    android:layout_weight="1"
    android:paddingTop="16dp"
    android:paddingBottom="16dp"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    custom:scv_crop_mode="fit_image"
    custom:scv_background_color="@color/windowBackground"
    custom:scv_handle_color="@color/colorAccent"
    custom:scv_guide_color="@color/colorAccent"
    custom:scv_overlay_color="@color/overlay"
    custom:scv_frame_color="@color/colorAccent"
    custom:scv_handle_size="14dp"
    custom:scv_touch_padding="8dp"
    custom:scv_handle_show_mode="show_always"
    custom:scv_guide_show_mode="show_always"
    custom:scv_min_frame_size="50dp"
    custom:scv_frame_stroke_weight="1dp"
    custom:scv_guide_stroke_weight="1dp"/>

Load image from sourceUri.

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

mCropView.load(sourceUri).execute(mLoadCallback);

with RxJava,

mCropView.load(sourceUri).executeAsCompletable();

Crop image and save cropped bitmap in saveUri.

mCropView.crop(sourceUri)
    .execute(new CropCallback() {
  @Override public void onSuccess(Bitmap cropped) {
    mCropView.save(cropped)
        .execute(saveUri, mSaveCallback);
  }

  @Override public void onError(Throwable e) {
  }
});

with RxJava,

mCropView.crop(sourceUri)
    .executeAsSingle()
    .flatMap(new Function<Bitmap, SingleSource<Uri>>() {
      @Override public SingleSource<Uri> apply(@io.reactivex.annotations.NonNull Bitmap bitmap)
              throws Exception {
        return mCropView.save(bitmap)
            .executeAsSingle(saveUri);
      }
    })
    .subscribeOn(Schedulers.newThread())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(new Consumer<Uri>() {
      @Override public void accept(@io.reactivex.annotations.NonNull Uri uri) throws Exception {
        // on success
      }
    }, new Consumer<Throwable>() {
      @Override public void accept(@io.reactivex.annotations.NonNull Throwable throwable)
              throws Exception {
        // on error
      }
    });

Image Rotation

SimpleCropView supports rotation by 90 degrees.

cropImageView.rotateImage(CropImageView.RotateDegrees.ROTATE_90D); // rotate clockwise by 90 degrees
cropImageView.rotateImage(CropImageView.RotateDegrees.ROTATE_M90D); // rotate counter-clockwise by 90 degrees

For a working implementation of this project, see sample project.

Load Image

  • load(sourceUri).execute(mLoadCallback);

with RxJava,

  • load(sourceUri).executeAsCompletable();

These method load Bitmap in efficient size from sourceUri. You don't have to care for filePath and image size. You can also use Picasso or Glide.

Apply Thumbnail

You can use blurred image for placeholder.

mCropView.load(result.getData())
         .useThumbnail(true)
         .execute(mLoadCallback);

Crop and Save Image

mCropView.crop(sourceUri)
    .execute(new CropCallback() {
  @Override public void onSuccess(Bitmap cropped) {
    mCropView.save(cropped)
        .execute(saveUri, mSaveCallback);
  }

  @Override public void onError(Throwable e) {
  }
});

with RxJava,

mCropView.crop(sourceUri)
    .executeAsSingle()
    .flatMap(new Function<Bitmap, SingleSource<Uri>>() {
      @Override public SingleSource<Uri> apply(@io.reactivex.annotations.NonNull Bitmap bitmap)
              throws Exception {
        return mCropView.save(bitmap)
                .executeAsSingle(saveUri);
      }
    })
    .subscribeOn(Schedulers.newThread())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(new Consumer<Uri>() {
      @Override public void accept(@io.reactivex.annotations.NonNull Uri uri) throws Exception {
        // on success
      }
    }, new Consumer<Throwable>() {
      @Override public void accept(@io.reactivex.annotations.NonNull Throwable throwable)
              throws Exception {
        // on error
      }
    });

These cropping method use full size bitmap taken from sourceUri for cropping. If sourceUri is null, the Uri set in load(Uri) is used. After cropping, it saves cropped image in saveUri.

Compress Format

You can use 3 compress format, PNG(default),JPEG, and WEBP.

setCompressFormat(Bitmap.CompressFormat.JPEG);

Compress Quality

You can also set compress quality. 0~100(default)

setCompressQuality(90);

Customization

Maximum Output Size

You can set max size for output image. The output image will be scaled within given rect.

setOutputMaxSize(300, 300);

Fixed Output Size

You can also set fixed output width/height.

setOutputWidth(100); // If cropped image size is 400x200, output size is 100x50
setOutputHeight(100); // If cropped image size is 400x200, output size is 200x100

CropMode

The option for the aspect ratio of the image cropping frame.

CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView);
cropImageView.setCropMode(CropImageView.CropMode.RATIO_16_9);

Values

FIT_IMAGE, RATIO_4_3, RATIO_3_4, SQUARE(default), RATIO_16_9, RATIO_9_16, FREE, CUSTOM, CIRCLE, CIRCLE_SQUARE

Rect Crop

FREE: Non-Fixed aspect ratio mode RATIO_X_Y, SQUARE: Fixed aspect ratio mode FIT_IMAGE: Fixed aspect ratio mode. The same aspect ratio as the original photo.

If you need other aspect ratio, use setCustomRatio(int ratioX, int ratioY);

demo

Circle Crop

CIRCLE: Fixed aspect ratio mode. Crop image as circle. CIRCLE_SQUARE: Fixed aspect ratio mode. Show guide circle, but save as square.(getRectBitmap() is removed.)

MinimumFrameSize

The minimum size of the image cropping frame in dp.(default:50)

CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView);
cropImageView.setMinFrameSizeInDp(100);

demo

InitialFrameScale

The initial frame size of the image cropping frame. 0.01~1.0(default)

CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView);
cropImageView.setInitialFrameScale(1.0f);
scale Appearance
0.5
0.75
1.0 (default)

Save and Restore FrameRect

You can save and restore frame rect as follows. See sample project for more details.

  • Save FrameRect
mCropView.getActualCropRect()
  • Restore FrameRect
mCropView.load(result.getData())
         .initialFrameRect(mFrameRect)
         .execute(mLoadCallback);

Color

CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView);
cropImageView.setBackgroundColor(0xFFFFFFFB);
cropImageView.setOverlayColor(0xAA1C1C1C);
cropImageView.setFrameColor(getResources().getColor(R.color.frame));
cropImageView.setHandleColor(getResources().getColor(R.color.handle));
cropImageView.setGuideColor(getResources().getColor(R.color.guide));

Stroke Weight and Handle Size

CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView);
cropImageView.setFrameStrokeWeightInDp(1);
cropImageView.setGuideStrokeWeightInDp(1);
cropImageView.setHandleSizeInDp(getResources().getDimension(R.dimen.handle_size));

Handle Touch Padding

Additional touch area for the image cropping frame handle.

CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView);
cropImageView.setTouchPadding(16);

Handle and Guide ShowMode

CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView);
cropImageView.setHandleShowMode(CropImageView.ShowMode.SHOW_ALWAYS);
cropImageView.setGuideShowMode(CropImageView.ShowMode.SHOW_ON_TOUCH);

Values

SHOW_ALWAYS(default), NOT_SHOW, SHOW_ON_TOUCH
Handle ShowMode Guide ShowMode Appearance
SHOW_ALWAYS SHOW_ALWAYS
NOT_SHOW NOT_SHOW
SHOW_ALWAYS NOT_SHOW
SHOW_ALWAYS SHOW_ON_TOUCH
SHOW_ON_TOUCH NOT_SHOW

Animation

SimpleCropView supports rotate animation and frame change animation.

Enabled

Toggle whether to animate. true is default.

setAnimationEnabled(true);

Duration

Set animation duration in milliseconds. 100 is default.

setAnimationDuration(200);

Interpolator

Set interpolator of animation. DecelerateInterpolator is default. You can also use your custom interpolator.

setInterpolator(new AccelerateDecelerateInterpolator());

Picasso and Glide Compatibility

com.isseiaoki.simplecropview.CropImageView is a kind of ImageView. You can use it with Picasso or Glide as follows:

CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView);
Picasso.with(context).load(imageUrl).into(cropImageView);

or

CropImageView cropImageView = (CropImageView)findViewById(R.id.cropImageView);
Glide.with(context).load(imageUrl).into(cropImageView);

Some option does not work correctly because CropImageView does not support ImageView.ScaleType.

Debug

You can use debug display.

setDebug(true);

XML Attributes

XML sample here.

<com.isseiaoki.simplecropview.CropImageView
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    android:id="@+id/cropImageView"
    android:layout_weight="1"
    android:paddingTop="16dp"
    android:paddingBottom="16dp"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    custom:scv_img_src="@drawable/sample5"
    custom:scv_crop_mode="fit_image"
    custom:scv_background_color="@color/windowBackground"
    custom:scv_overlay_color="@color/overlay"
    custom:scv_frame_color="@color/colorAccent"
    custom:scv_handle_color="@color/colorAccent"
    custom:scv_guide_color="@color/colorAccent"
    custom:scv_guide_show_mode="show_always"
    custom:scv_handle_show_mode="show_always"
    custom:scv_handle_size="14dp"
    custom:scv_touch_padding="8dp"
    custom:scv_min_frame_size="50dp"
    custom:scv_frame_stroke_weight="1dp"
    custom:scv_guide_stroke_weight="1dp"
    custom:scv_crop_enabled="true"
    custom:scv_initial_frame_scale="1.0"
    custom:scv_animation_enabled="true"
    custom:scv_animation_duration="200"
    custom:scv_handle_shadow_enabled="true"/>
XML Attribute
(custom:)
Related Method Description
scv_img_src setImageResource(int resId) Set source image.
scv_crop_mode setCropMode(CropImageView.CropMode mode) Set crop mode.
scv_background_color setBackgroundColor(int bgColor) Set view background color.
scv_overlay_color setOverlayColor(int overlayColor) Set image overlay color.
scv_frame_color setFrameColor(int frameColor) Set the image cropping frame color.
scv_handle_color setHandleColor(int frameColor) Set the handle color.
scv_guide_color setGuideColor(int frameColor) Set the guide color.
scv_guide_show_mode setGuideShowMode(CropImageView.ShowMode mode) Set guideline show mode.
scv_handle_show_mode setHandleShowMode(CropImageView.ShowMode mode) Set handle show mode.
scv_handle_size setHandleSizeInDp(int handleDp) Set handle radius in density-independent pixels.
scv_touch_padding setTouchPaddingInDp(int paddingDp) Set the image cropping frame handle touch padding(touch area) in density-independent pixels.
scv_min_frame_size setMinFrameSizeInDp(int minDp) Set the image cropping frame minimum size in density-independent pixels.
scv_frame_stroke_weight setFrameStrokeWeightInDp(int weightDp) Set frame stroke weight in density-independent pixels.
scv_guide_stroke_weight setGuideStrokeWeightInDp(int weightDp) Set guideline stroke weight in density-independent pixels.
scv_crop_enabled setCropEnabled(boolean enabled) Set whether to show the image cropping frame.
scv_initial_frame_scale setInitialFrameScale(float initialScale) Set Set initial scale of the frame.(0.01 ~ 1.0)
scv_animation_enabled setAnimationEnabled(boolean enabled) Set whether to animate.
scv_animation_duration setAnimationDuration(int durationMillis) Set animation duration.
scv_handle_shadow_enabled setHandleShadowEnabled(boolean handleShadowEnabled) Set whether to show handle shadows.

Developed By

Issei Aoki - [email protected]

Users

If you are using my library, please let me know your app name : )

For Xamarin

https://bitbucket.org/markjackmilian/xam.droid.simplecropview

Thanks a million to Marco!!!

License

The MIT License (MIT)

Copyright (c) 2015 Issei Aoki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • java.lang.IllegalArgumentException: x + width must be <= bitmap.width()

    java.lang.IllegalArgumentException: x + width must be <= bitmap.width()

    Hello,

    I am getting this exception:

    java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
     at android.graphics.Bitmap.createBitmap(Bitmap.java:698)
     at com.isseiaoki.simplecropview.CropImageView.getCroppedBitmap(SourceFile:1012)
     at bci.onClick(SourceFile:1064)
     at android.view.View.performClick(View.java:4463)
     at android.view.View$PerformClick.run(View.java:18801)
     at android.os.Handler.handleCallback(Handler.java:808)
     at android.os.Handler.dispatchMessage(Handler.java:103)
     at android.os.Looper.loop(Looper.java:193)
     at android.app.ActivityThread.main(ActivityThread.java:5299)
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:515)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
     at dalvik.system.NativeStart.main(Native Method)
    

    every once in a while. Any idea on what's happening there?

    Cheers, Sakis

    opened by athkalia 12
  • startCrop throw

    startCrop throw "UnKown URI"

    private Uri saveImage(Bitmap bitmap, final Uri uri) throws IOException, IllegalStateException { mSaveUri = uri; if (mSaveUri == null) { throw new IllegalStateException("Save uri must not be null."); }

    OutputStream outputStream = null;
    try {
      outputStream = getContext().getContentResolver().openOutputStream(uri);
      bitmap.compress(mCompressFormat, mCompressQuality, outputStream);
      Utils.copyExifInfo(getContext(), mSourceUri, uri, bitmap.getWidth(), bitmap.getHeight());
      Utils.updateGalleryInfo(getContext(), uri);//ERROR
      return uri;
    } finally {
      Utils.closeQuietly(outputStream);
    }
    

    }

    needs info 
    opened by JanesenGit 8
  • Can't save cropped image, UnsupportedOperationException

    Can't save cropped image, UnsupportedOperationException

    java.lang.UnsupportedOperationException at java.util.AbstractList.add(AbstractList.java:404) at java.util.AbstractList.add(AbstractList.java:425) at com.isseiaoki.simplecropview.util.Utils.copyExifInfo(Utils.java:85) at com.isseiaoki.simplecropview.CropImageView.saveImage(CropImageView.java:1316) at com.isseiaoki.simplecropview.CropImageView.access$2100(CropImageView.java:58) at com.isseiaoki.simplecropview.CropImageView$17.call(CropImageView.java:1861) at com.isseiaoki.simplecropview.CropImageView$17.call(CropImageView.java:1858) at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:35)

    I catch this Exception when tried to save image, my code:

    mCropView.crop(mCropView.getSourceUri())
                        .executeAsSingle()
                        .flatMap(bitmap -> {
                            Timber.d("On crop, image size: %dx%d", bitmap.getWidth(), bitmap.getHeight());
                            return mCropView.save(bitmap)
                                    .executeAsSingle(saveUri);
                        })
                        .subscribeOn(Schedulers.newThread())
                        .observeOn(AndroidSchedulers.mainThread())
                        .subscribe(uri -> {
                            Timber.d("On Crop, croppedPhotoUri: %s", uri);
                            dismiss();
                        }, throwable -> Timber.e(throwable));
    

    How can I resolve this issue ?

    opened by AlexEvtushik 5
  • RejectedExecutionException crashes

    RejectedExecutionException crashes

    My Google Console reports dozens of RejectedExecutionException crashes with the version of 1.6.

    ===========================================

    Samsung Galaxy J5(2016) (j5xnlte), 2048MB RAM, Android 6.0 Report 1 of 9

    java.lang.RuntimeException: at android.app.ActivityThread.deliverResults (ActivityThread.java:4927) at android.app.ActivityThread.handleSendResult (ActivityThread.java:4970) at android.app.ActivityThread.access$1600 (ActivityThread.java:223) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1851) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os.Looper.loop (Looper.java:158) at android.app.ActivityThread.main (ActivityThread.java:7231) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

    Caused by: java.util.concurrent.RejectedExecutionException: at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution (ThreadPoolExecutor.java:2014) at java.util.concurrent.ThreadPoolExecutor.reject (ThreadPoolExecutor.java:794) at java.util.concurrent.ThreadPoolExecutor.execute (ThreadPoolExecutor.java:1340) at java.util.concurrent.AbstractExecutorService.submit (AbstractExecutorService.java:82) at java.util.concurrent.Executors$DelegatedExecutorService.submit (Executors.java:594) at com.isseiaoki.simplecropview.CropImageView.loadAsync (CropImageView.java:1438) at com.isseiaoki.simplecropview.LoadRequest.execute (LoadRequest.java:40) at com.threesumatch.Components.compCrop.loadImage (compCrop.java:212) at com.threesumatch.Fragments.FragmentMe.onActivityResult (FragmentMe.java:981) at android.app.Activity.dispatchActivityResult (Activity.java:7162) at android.app.ActivityThread.deliverResults (ActivityThread.java:4923)

    needs info 
    opened by stonelai 4
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 4
  • App crashes when go in onPause(), java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 20195964 bytes

    App crashes when go in onPause(), java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 20195964 bytes

    Android version N,

    compileSdkVersion 25 buildToolsVersion '24.0.3'

    minSdkVersion 17 targetSdkVersion 25

    java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 20195964 bytes at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3776) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6123) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757) Caused by: android.os.TransactionTooLargeException: data parcel size 20195964 bytes at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(Binder.java:615) at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3700) at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3768) at android.os.Handler.handleCallback(Handler.java:751)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6123)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757) 

    opened by harshgaba 4
  • Significant increase in size

    Significant increase in size

    I have found that when an image is cropped, the size automatically increases. This has been reported previously in issues #78, but no response. Someone may say something about it?

    opened by Vierco 4
  • CropImageView SavedState takes too much space and crashes

    CropImageView SavedState takes too much space and crashes

    Be careful on the CropImageView.onSaveInstanceState, because if i use a big bitmap, there's a chance that the app crashes.

    I have CropImageView inside a fragment, and, when the app goes in background, it throws TransactionTooLargeException. I've seen on onSaveInstanceState method that you save the bitmap inside the Bundle and i don't think this is a good practice.

    To avoid this crash, i call setImageDrawable(null) when the Fragment goes inside onPause method

    enhancement 
    opened by GrindingOgre 4
  • Overlay drawing is lacking when selecting certain photos

    Overlay drawing is lacking when selecting certain photos

    When I select certain photos overlay drawing is lacking a line in top and/or bottom. Here's a screenshot of what is happening:

    _20160426_155608

    As you can see in the screenshot above, the top line of overlay is not getting drawn. Here is how I am using CropImageView

    <com.isseiaoki.simplecropview.CropImageView
            android:id="@+id/cropImageView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="16dp"
            custom:scv_crop_mode="free"
            custom:scv_guide_color="@color/accentColor"
            custom:scv_handle_color="@color/accentColor"
            custom:scv_frame_color="@color/accentColor"
            custom:scv_background_color="@color/solidBlack"
            custom:scv_handle_size="8dp"
            custom:scv_touch_padding="10dp" />
    

    Let me know if you need more info. I can also email you the original photo which caused this.

    opened by avsector 4
  • Just crop the Image displayed in the ImageView?

    Just crop the Image displayed in the ImageView?

    Sometimes, You want to crop an large picture, it may be 8000x6000, And then, App use a Loader such as picasso to display a thumbnail image to the ImageView to prevent OutOfMemory crash. Maybe, a 400x300 picture to displayed in the ImageView. Then cropping of the image is not cropping to the original image, in other words, it cannot get a cropped image to original picture..

    opened by gordonpro 4
  • IllegalArgumentException when cropping certain size image

    IllegalArgumentException when cropping certain size image

    Hi,

    I got this error message whenever I'm trying to crop 1200 x 1200px (or its multiply 2400 x 2400 etc) image. java.lang.IllegalArgumentException: y + height must be <= bitmap.height() at android.graphics.Bitmap.createBitmap(Bitmap.java:669) at com.isseiaoki.simplecropview.CropImageView.getCroppedBitmap(CropImageView.java:1012)

    I called getCroppedBitmap() without resize the image (moving the handle)

    I'm using: cropMode="ratio_1_1" handleSize="12dp" minFrameSize="200dp" initialFrameScale="1.0"

    Can you help me? Thank you

    opened by gcrescent 4
  • Resolve #29, Crop rectangle based on coordinate

    Resolve #29, Crop rectangle based on coordinate

    Hi, for issue #29, I added a function to set the crop rectangle in runtime. By calling setFrameRect function in CropImageView, It will adjust the rectangle on the given RectF, relative to the image frame. Note that calling this function will also set the image mode to FREE as the given rectangle may not be consistent with the old aspect ratio.

    opened by taslimisina 0
Releases(v1.1.6)
Owner
Issei Aoki
Software Engineer
Issei Aoki
Image Cropping Library for Android

Image Cropping Library for Android

Lyrebird Studio 1.1k Dec 30, 2022
Image cropping library written with Jetpack Compose with other Composables such as ImageWithConstraints scales Bitmap

Image cropping library written with Jetpack Compose with other Composables such as ImageWithConstraints scales Bitmap it displays and returns position and bounds of Bitmap and ImageWithThumbnail to display thumbnail of the image on selected corner.

Smart Tool Factory 9 Jul 27, 2022
Android widget for cropping and rotating an image.

Cropper The Cropper is an image cropping tool. It provides a way to set an image in XML and programmatically, and displays a resizable crop window on

Edmodo 2.9k Nov 14, 2022
Awesome Image Picker library will pick images/gifs with beautiful interface. Supports image or gif, Single and Multiple Image selection.

Awesome Image Picker Awesome Image Picker library will pick images/gifs with beautiful interface. Supports image or gif, Single and Multiple Image sel

Prabhakar Thota 162 Sep 13, 2022
Android library project for cropping images

I guess people are just cropping out all the sadness An Android library project that provides a simple image cropping Activity, based on code from AOS

Jamie McDonald 4.5k Jan 7, 2023
This is an Image slider with swipes, Here we used Volley to Image load URL's from JSON! Here we make it very easy way to load images from Internet and We customized the description font style(OpenSans).

ImageSliderWithSwipes This is an Image slider with swipes, Here we used Volley to load URL's from JSON! Here we make it very easy way to load images f

Prabhakar Thota 44 May 31, 2021
Simple android image popup Library

Android Image Popup Show image as a popup on a click event or any event. Simply set the image as drawable and thats it!!!. And also you can set width,

Chathura Lakmal 64 Nov 15, 2022
🎨 Modern image loading library for Android. Simple by design, powerful under the hood.

Simple Image Loader Modern image loading library for Android. Simple by design, powerful under the hood. Kotlin: Simple Image Loader is Kotlin-native

Igor Solkin 8 Nov 21, 2022
🐶 Simple app which shows random dog image from Dog API

?? Doggy App ?? ?? Simple app which shows random dog image from Dog API with Retrofit2 and Glide ?? ❤️ Retrofit @GET Request YouTube Tutorial! (Stevdz

Yağmur Erdoğan 10 Nov 1, 2022
An android image compression library.

Compressor Compressor is a lightweight and powerful android image compression library. Compressor will allow you to compress large photos into smaller

Zetra 6.7k Dec 31, 2022
Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon

This project is no longer supported. If you're able to switch from Fresco to any other library that works with the Android's ImageView, please migrate

Stfalcon LLC 1.8k Dec 19, 2022
Dali is an image blur library for Android. It contains several modules for static blurring, live blurring and animations.

Dali Dali is an image blur library for Android. It is easy to use, fast and extensible. Dali contains several modules for either static blurring, live

Patrick Favre-Bulle 1k Dec 1, 2022
An image resizing library for Android

Resizer Inspired by zetbaitsu's Compressor, Resizer is a lightweight and easy-to-use Android library for image scaling. It allows you to resize an ima

Kakit Ho 426 Dec 22, 2022
Image loading library for Android

Image Loader Image loader library for Android. Deprecated. See Glide. Features Image transformations Automatic memory and storage caching Ability to l

Yuriy Budiyev 19 May 28, 2022
An image loading library for android.

Bilder Download Add following to your project's build.gradle allprojects { repositories { ... maven { url 'https://jitpack.io' } } }

Kshitij Sharma 4 Jan 1, 2022
An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.

An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.

Daichi Furiya 257 Jan 2, 2023
A small customizable library useful to handle an gallery image pick action built-in your app. :sunrise_over_mountains::stars:

Louvre A small customizable image picker. Useful to handle an gallery image pick action built-in your app. *Images from Google Image Search Installati

André Mion 640 Nov 19, 2022
Library to save image locally and shows options to open and share !

Image Save and Share Library to save image locally and shows options to open and share ! Download Demo APK from HERE Kindly use the following links to

Prabhakar Thota 27 Apr 18, 2022
RoundedImageView-Library 0.9 0.0 Java To set single or multiple corners on Image Views.

RoundedImageView-Library Rounded ImageView Android Library, to set single or multiple corners on imageview. Screenshot Usage Step 1. Add the JitPack r

Dushyant Mainwal 15 Sep 2, 2020