Giter Club home page Giter Club logo

simplecropview's Introduction

simplecropview's People

Contributors

bryant1410 avatar igreenwood avatar liaohuqiu avatar mapyo avatar mlnkrish avatar mronyszko avatar rainer-lang avatar sumimakito avatar tinsuke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simplecropview's Issues

Very Slow on Android 5.1.1

The SimpleCropView is very slow on Android 5.1.1.
I tested it on others and it looks great, but in Android 5.1.1 is too slow

Message: skip frames, much work on main thread

Response: The image was too big.

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

Option to keep Exif data

Currently when you crop a photo all the exif data from the original photo gets nuked. There should be a way to keep the exif data from the original photo so the gps data and time stamp dont get deleted

Performance issues on portrait images

Firstly, fantastic library, I like the way it looks, how easy is to implement and use it.

I only have one issue and I don't know to what it is related: when I am working with a portrait image, there are performance issues with dragging the rectangle or resizing it. This does not happen when using a landscape picture, even if the landscape picture's size is bigger.

Maintain aspect ratio when modifying output dimensions

Hey,

I ran into an issue when setting output sizes. The resizing seems to derive an aspect ratio from getRatioX() and getRatioY(), which, in the typical use case, results in an image of size 1:1. What would be much more expected would be to resize the cropped selection and maintain that aspect ratio rather than overwrite/ignore it.

This change would be very simple. You would just need to change some code in CropImageView.java in the method scaleBitmapIfNeeded(Bitmap). The only line that needs changing would be this:

float imageRatio = getRatioX() / getRatioY();

to

float imageRatio = (float) width / (float) height;

(Maybe change the var name to croppedRatio?)

I've currently copied the class locally and replaced this line and have it functioning correctly. However, I would love to get this in the library. I don't mind making a PR. Let me know ^_^

Russell

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..

setImageUrl

there is something wrong with setImageUrl.

Question

Hi. Can I get cropped region coordinates?

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.

OutOfMemoryError

When trying to load a camera image from my Galaxy s6, the app force closes.

at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:527)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:599)
at android.provider.MediaStore$Images$Media.getBitmap(MediaStore.java:724)
at com.shifat.cropandupload.MainActivity.onActivityResult(MainActivity.java:66)
at android.app.Activity.dispatchActivityResult(Activity.java:5192)

Cannot view the crop editor activity in phone(api 19) but able to view it in emulator nexus4 api22?

I can able to crop image in emulator but can not do it in real device of api 19 . can anyone please help me with this issue?
` if (requestCode == REQUEST_CHOOSE_FILE) {
Uri imageUri = data.getData();
// filename= data.getData().getLastPathSegment();
filename= data.getData().getPath();

            try {

                Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri);
                Intent i=new Intent(MyProfileActivity.this,SetImage.class);
                i.putExtra("Bitmap",bitmap);
                startActivity(i);

             profilePic.setImageBitmap(bitmap);
             save.setVisibility(View.VISIBLE);
            } catch (IOException e) {
                e.printStackTrace();
            }
}`

This is my code and I can not go to setImage activity which has code for cropping the image in phone.
Code of setImage activity is here:

` @OverRide
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_image);

    cancelbutton = (Button) findViewById(R.id.btnCancel);
    ok = (Button) findViewById(R.id.btnOk);
    crop=(Button)findViewById(R.id.btnCrop);
    croppedImageView = (ImageView) findViewById(R.id.croppedimageView);
    image = (CropImageView) findViewById(R.id.imageView);
    image.setCropMode(CropImageView.CropMode.RATIO_1_1);
    image.setMinFrameSizeInDp(100);
    image.setBackgroundColor(0xFFFFFFFB);
    image.setOverlayColor(0xAA1C1C1C);
    image.setFrameColor(getResources().getColor(R.color.primary));
    image.setHandleColor(getResources().getColor(R.color.white));
    image.setGuideColor(getResources().getColor(R.color.white));
    cancelbutton.setOnClickListener(this);
    ok.setOnClickListener(this);
    crop.setOnClickListener(this);

    String imagePath = getIntent().getStringExtra("imagePath");

    Bitmap bitmap = (Bitmap) getIntent().getParcelableExtra("Bitmap");
    image.setImageBitmap(bitmap);

}`

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

ClassCastException ColorDrawable cannot be cast to BitmapDrawable

java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.graphics.drawable.BitmapDrawable
                                                                           at com.isseiaoki.simplecropview.CropImageView.getBitmap(CropImageView.java:924)
                                                                           at com.isseiaoki.simplecropview.CropImageView.setImageResource(CropImageView.java:964)

Unmarshalling unknown type code 51 at offset 400

Hi,

We are getting an error like :

java.lang.RuntimeException: Unable to start activity ComponentInfo{....CropImageActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@41b317a0: Unmarshalling unknown type code 51 at offset 400
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2279)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2329)
at android.app.ActivityThread.access$800(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5214)
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:814)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:630)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Parcel android.os.Parcel@41b317a0: Unmarshalling unknown type code 51 at offset 400
at android.os.Parcel.readValue(Parcel.java:2092)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:2396)
at android.os.Parcel.readSparseArray(Parcel.java:1747)
at android.os.Parcel.readValue(Parcel.java:2082)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2329)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.getSparseParcelableArray(Bundle.java:1273)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1745)
at android.app.Activity.onRestoreInstanceState(Activity.java:944)
at android.app.Activity.performRestoreInstanceState(Activity.java:916)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1138)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2329)
            at android.app.ActivityThread.access$800(ActivityThread.java:145)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5214)
            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:814)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:630)
            at dalvik.system.NativeStart.main(Native Method)

Can you help me?

Thanks

Setting Drawable to SimpleCropView causes undefined behavior

Very nice and clean library!

I was trying to use it with Picasso. Images load just fine, they show up, but without cropping frame. Also, trying to rotate CropView with the new rotation method causes crash:

Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at com.isseiaoki.simplecropview.CropImageView.rotateImage(CropImageView.java:972)

The actual reason is that Picasso uses PicassoDrawable internally to load images into ImageViews. And SimpleCropView doesn't have corresponding method overloaded. As a workaround, I use callback to get bitmap and set it directly to CropView. But it would be nice if it worked out of box.

please remove "<application android:label="@string/app_name">"

Error:Execution failed for task ':app:processDevDebugManifest'.

Manifest merger failed : Attribute application@label value=(@string/XYZ) from AndroidManifest.xml:74:9-40
is also present at [com.isseiaoki:simplecropview:1.0.13] AndroidManifest.xml:11:18-50 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:71:5-374:19 to override.

NullPointException in Utils.getExifOrientation()

public static int getExifOrientation(Context context, Uri uri) {
        String authority = uri.getAuthority().toLowerCase();
        int orientation;
        if (authority.endsWith("media")) {
            orientation = getExifRotation(context, uri);
        } else {
            orientation = getExifRotation(getFileFromUri(context, uri));
        }
        return orientation;
    }

uri.getAuthority() == null will cause NullPointException. For example: Uri "/storage/emulated/0/homerun/homerun-Pictures/IMG_20160615_075035.jpg"

Inconsistency when changing mIsCropEnabled value

Consider this case. I enable crop using setCropEnabled(true) and adjust crop frame. Then I disable crop using setCropEnabled(false). Now if I call startCrop() I suppose it should ignore the previously set crop frame, but it will crop according to the frame which was set when crop was enabled.

I think calcCropRect() should take the value of mIsCropEnabled into account. Or at least there should be a public method to reset crop frame.

Sorry if I am buzzing you with a lot of issues. Thank you for taking the time to check these out.

Disable cropping resize

I just want to fit the image cropping frame to fit the device width or Image width and height accordingly to maintain aspect ratio. I want to make it fix so that use can not resize it just can drag it to select desire portion of the image.

If I use setEnabled(false); then it also stops dragging feature. I want to provide the user to select the portion of the image to crop but don't want to resize the cropping area (disable resize using 4 dots at the corner of grid)

So how can I achieve this? Can you please provide this feature also. Also the modes like fit to width (height should be as it is to maintain aspect ration) same way fit to height and so on....

Migrating from old version

I have your older version of the library and those did not have the mCropView.startCrop and mCropView.startLoad methods. Also i developed it around where I pass the absolute path to the file and load it in the CropImageView bitmap.
Since you have introduced the uri model, is it mandatory to use this?
Its going be quite tough to convert all the logic to uri based.

Jar version

is there any jar version for this library? because of some limitation I unable to use gradle in my projects, thanks

Critical issue

Hi guys. You are made awesome widget. But it has one critical bug. When set widget's width or height to match_parent it became laggy. Looks like something going wrong on measure or on layout stage or something else running into the loop.
GPU monitor http://screencloud.net/v/xc3i
Memory monitor http://screencloud.net/v/1Y8k (leaking memory)
I have only one activity with SimpleCropView width and height are match_parent.

Sorry, my mistake. I loaded 8 megapixels bitmap into view directly.

Smasung Note 3 Crop Screen

After approving the taken image we get teh crop screen. But, the image view does not contain an image and the crop region is near pure white, I've attached a screenshot as a reference. It is worthy to note that this does not happen on any other device we have tested on thus far.

Image of Bug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.