biokys / cropimage Goto Github PK
View Code? Open in Web Editor NEWReplacement for deprecated official Android crop image function
Replacement for deprecated official Android crop image function
Hello!
Great library! I've had much ease in integrating and tweaking the library to my requirements. But, I have been trying to implement this in a wallpaper app, where I need multiple options for the user to set the wallpaper as, scrollable, fixed etc.
How can I draw predefined grid on the image to be cropped?
Something like this:
http://awesomescreenshot.com/0722wkzhfa
Any assistance in this regard is much appreciated!
Thanks,
Arnab
I am using this library in a situation where I don't want to allow user to change the size of the cropper rectangle. I have made some changes in the library to add this support, but I don't know the process of submitting my changes. Can any one guide?
Hi i am getting strange exception when i take picture from camera and try to crop it.
Here is my log cat.
I am facing this issue on Galaxy Grand with os 4.2.2
11-25 17:44:28.909: E/AndroidRuntime(30645): FATAL EXCEPTION: Thread-6510
11-25 17:44:28.909: E/AndroidRuntime(30645): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@42765a00
11-25 17:44:28.909: E/AndroidRuntime(30645): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1026)
11-25 17:44:28.909: E/AndroidRuntime(30645): at android.graphics.Canvas.drawBitmap(Canvas.java:1096)
11-25 17:44:28.909: E/AndroidRuntime(30645): at android.graphics.Bitmap.createBitmap(Bitmap.java:646)
11-25 17:44:28.909: E/AndroidRuntime(30645): at eu.janmuller.android.simplecropimage.CropImage$1.prepareBitmap(CropImage.java:558)
11-25 17:44:28.909: E/AndroidRuntime(30645): at eu.janmuller.android.simplecropimage.CropImage$1.run(CropImage.java:564)
11-25 17:44:28.909: E/AndroidRuntime(30645): at eu.janmuller.android.simplecropimage.CropImage$6.run(CropImage.java:271)
11-25 17:44:28.909: E/AndroidRuntime(30645): at eu.janmuller.android.simplecropimage.Util$BackgroundJob.run(Util.java:175)
11-25 17:44:28.909: E/AndroidRuntime(30645): at java.lang.Thread.run(Thread.java:856)
Is there a way to set a crop when I call activity? for example, I save original image in order to be able to edit crop. So I save rectangle (I modified activity in order to return crop rectangle, I'll make a push request later) and I'd like to use saved rectangle to set the crop.
Test on SAMSUNG 2.2 and 4.1(N7100).
Because the SAMSUNG phone destroy the MainActivity and create it again when returning from the Take Picture Activity, the mImageCaptureUri is null, leads to the NullPointerException. Some phones won't destroy MainActivity when returning, so the mImageCaptureUri has its value and the program works well.
Solution:
Move the initialization of mImageCaptureUri from doTakePhotoAction() to onCreate(), and remove the milliseconde adding from the file name.
Right after selecting the image from gallery, the cropping class is getting called. After selecting the portion in the image to crop and tapping crop nothing happens. This happens only in samsung devies, especially Galaxy S6 and S6 edge. Please help. Below is the code i am using to call the CropImage class.
Intent intent = new Intent(context, CropImage.class);
intent.putExtra(CropImage.IMAGE_PATH, path);
intent.putExtra(CropImage.SCALE, true);
intent.putExtra(CropImage.ASPECT_X, 2);
intent.putExtra(CropImage.ASPECT_Y, 2);
getActivity().startActivityForResult(intent, PIC_CROP);
Has someone face similar issues?
I'm trying to crop camera, but the result is that mi cropped image is being banded and with a low quality.
¿Is this the normal behavior or I'm doing something wrong?
here i try to crop image but its crop tool selection done only in square. can we select crop area also only from horizontal or vertical side. means not on only square?
I need to make some changes according to my needs. I just want to have your approval on this.
Thanks!
I want to set crop dimension to 1280x640 and I do not want it to expand. How to do it?
Hi, on some of the newer Android devices, when we do crop image inside Gallery, it shows a blue border (instead of orange) and we may resize the border on say the right edge and the left edge will stay still without moving.. I think this behaviour makes more sense as it is easier to select the cropping area this way. I read the source code of this library but couldn't figure out how to modify to make it behave like I want it to... can someone better with maths help? :)
If someone know where to find the new image crop source code (with blue border) please share too.. thanks!
doCrop method doesn't work. Nothing is happening on my Nexus7
imageUri is fine
Hi, Please help.
I am running the sample project which came with the library, I am using Samsung Galaxy S2 - Skyrocket with Android 4.1.2
So I am getting this error (Canvas: trying to use a recycled bitmap) only at the first launch and first click on "Take picture". so once I take picture then instead of start crop intent the app crashes.
this error never comes back unless I uninstall app from device and re launch it after new installation.
Following is the error I am getting:
08-22 22:59:33.075: E/AndroidRuntime(14947): FATAL EXCEPTION: Thread-47491
08-22 22:59:33.075: E/AndroidRuntime(14947): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@421fd9b0
08-22 22:59:33.075: E/AndroidRuntime(14947): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1026)
08-22 22:59:33.075: E/AndroidRuntime(14947): at android.graphics.Canvas.drawBitmap(Canvas.java:1096)
08-22 22:59:33.075: E/AndroidRuntime(14947): at android.graphics.Bitmap.createBitmap(Bitmap.java:604)
08-22 22:59:33.075: E/AndroidRuntime(14947): at eu.janmuller.android.simplecropimage.CropImage$1.prepareBitmap(CropImage.java:572)
08-22 22:59:33.075: E/AndroidRuntime(14947): at eu.janmuller.android.simplecropimage.CropImage$1.run(CropImage.java:578)
08-22 22:59:33.075: E/AndroidRuntime(14947): at eu.janmuller.android.simplecropimage.CropImage$6.run(CropImage.java:285)
08-22 22:59:33.075: E/AndroidRuntime(14947): at eu.janmuller.android.simplecropimage.Util$BackgroundJob.run(Util.java:175)
08-22 22:59:33.075: E/AndroidRuntime(14947): at java.lang.Thread.run(Thread.java:856)
Please help.
Thanks!
HI,
i was trying to get the lib working for my project. I tried sevarl mthods to import the lib porject or the lib into libs to buildpath etc. ma app was compiling with no errors but console says did not find class or did not find R$Layout.
The example app runs fine, compiling using eclipse with adt.
Please can you advice to get it working?
regards
Hi,
Is there anyone who has tested this library on the Kitkat??
Regards,
Sunil
I have samsung galaxy Grand and i am not able to run on this device it just gets close without any error. do not redirecting to crop section after selecting image.
I use ECLIPES IDE and I can't import simple-crop-image-lib.
anyone help me? please more detail.. thanks.
Hi,
I receive this crash from crittercism. The only information that I have is that the activity eu.janmuller.android.simplecropimage.CropImage was open when the crash happens. It has occur only one time, any ideas?
java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:672)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:368)
at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
at android.app.Dialog.dismissDialog(Dialog.java:319)
at android.app.Dialog$1.run(Dialog.java:119)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
If I understand correctly, in the documentation of usage you should change the mFileTemp.getPath() to path you are getting on callback to onActivityResult.
Save and Cancel actions should be swapped in favour of placing affirmative actions on the right-hand side as per design guide lines.
Can anyone send me the whole code with R.java for android and all in zip file. I am not able to run between two classes, main to CropImage.java. Thanks a lot.
HI,
thanks for this useful library, it would be very good if we have an option that specify the minimum and maximum size of cropped image (width X height) .
thanks
i have a few images stored in res/drawable-hdpi folder which i want to use for cropping... how can i use them with your library?
Hi,
I am using biokys lib to crop image,can someone help me how to crop image without any aspect ratio ?
when i set the aspect ratio to 0 in
intent.putExtra(CropImage.ASPECT_X, 0);
intent.putExtra(CropImage.ASPECT_Y, 0);
ans start the crop activity,in the crop screen when i change the rectangle line to new place the opposite side line is increasing proportionally.I dont want this effect.
I only want to give square cropping of my image.
Error:Failed to find: com.github.biokys:cropimage:09d567ef9d
openFile
Open in Project Structure dialog
06-20 18:12:20.450: E/AndroidRuntime(8667): Caused by: java.lang.NullPointerException
06-20 18:12:20.450: E/AndroidRuntime(8667): at eu.janmuller.android.simplecropimage.CropImage.onCreate(CropImage.java:98)
06-20 18:12:20.450: E/AndroidRuntime(8667): at android.app.Activity.performCreate(Activity.java:5206)
06-20 18:12:20.450: E/AndroidRuntime(8667): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
06-20 18:12:20.450: E/AndroidRuntime(8667): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
06-20 18:12:20.450: E/AndroidRuntime(8667): ... 11 more
Hi i am getting nullpointer exception in your library class at
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
mImageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
Please help me with this!...
When i used your project as libarary it was giving me error that fail to deliver result. stating activity is not declared in manifest. then i copied your package to my project that error went way .. but now getting nullpointer exception.
When i am running this app in tablet its layout arranged automatically at top and center
Hi,
Can you provide a downloadable jar file? Compiling the source code as an imported module won't work.
Under which licence do you have put your classes (expect those from asop)?
There are few things missing and the project doesn't compile.
In the CropImage class
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
mImageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
There is no code HONEYCOMB and LAYER_TYPE_SOFTWARE
also in Util class in int rotation = activity.getWindowManager().getDefaultDisplay().getRotation(); there is no getRotation() method
Error:Could not find com.android.tools.build:gradle:2.2.2.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.jar
Required by:
2way:simple-crop-image-lib:unspecified
When I take a picture in portrait mode, the crop view automatically rotates it by 90 degrees. Does not seem to happen in landscape. Is there a way to prevent this?
I'd like to prevent the user from cropping the image smaller than a given number of pixels in both the x and y direction. Does anybody know how to do this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.