Comments (4)
I make it workaround like this.
public Bitmap applyCropTo(Bitmap bitmap) {
int x = findRealCoordinate(bitmap.getWidth(), cropRect.left, imageRect.width());
int y = findRealCoordinate(bitmap.getHeight(), cropRect.top, imageRect.height());
int width = findRealCoordinate(bitmap.getWidth(), cropRect.width(), imageRect.width());
int height = findRealCoordinate(bitmap.getHeight(), cropRect.height(), imageRect.height());
if (x < 0) {
x = 0;
}
if (y + height >= bitmap.getHeight()) {
y = bitmap.getHeight() - height;
}
Log.d(TAG, "x/y/with/height : " + x + "/" + y + "/" + width + "/" + height);
Bitmap immutableCropped = Bitmap.createBitmap(bitmap,
x,
y,
width,
height);
return immutableCropped.copy(immutableCropped.getConfig(), true);
}
from cropiwa.
I will suppose x to be width? have you tried checking what width is returned so compare and see first?
from cropiwa.
CropImageTask -> doInBackground -> IOException changed to catch (Exception e) {
Return e;
}
CropArea -> applyCropTo (Bitmap bitmap) -> changed to public Bitmap applyCropTo (Bitmap bitmap) throws IllegalArgumentException
Above can prevent crashes.
CropIwaView -> preceded by judgment: crop (CropIwaSaveConfig saveConfig) {
If (imageView.getImageRect (). Left == -1 || imageView.getImageRect (). Left == 0) {
Return;
}
}
If the crop method has not yet completed, it will be returned, of course, here you can do other operating logic.
from cropiwa.
I've fixed this issue with posting message on UI thread. It seems that this exception is raised when sixe of view is still not set.
cropView.post(() ->
cropView.crop(new CropIwaSaveConfig.Builder(croppedFileDestination)
.setCompressFormat(Bitmap.CompressFormat.JPEG)
.setQuality(80)
.build()));
from cropiwa.
Related Issues (20)
- How to set background color of CropIwaView?
- Build tool version and dependency support library HOT 1
- crash with cropiwa while cropping image HOT 4
- crop size more than screen width
- crash when the image not positioned on overlay HOT 2
- How to get x and y position of grid? HOT 1
- How to use this library for camera HOT 1
- setsize height and width for output not working
- Set Crop View position
- Warning: CropIwaOvalShape: can't find referenced method 'int save(int)'
- Get Black sreen after I save image and dispay on content Page in xamarin.
- How to make crop shape without margin HOT 1
- reset zoom level while loading multiple images in same cropview
- When attempting to run sample, following error occurs. HOT 1
- Custom touch listener | Ability to add custom gestures
- Crash when the Uri has "content://" scheme
- Center the crop window in the frame
- After cropping croppedUri gives original image not cropped how to fix that?
- How to set image set ScaleType ? HOT 1
- An error occured while executing doInBackground()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cropiwa.