Compose-Cropper
Compose-Cropper copied to clipboard
java.lang.IllegalArgumentException: height must be > 0
Thanks for this, it's just what I need! :)
I copied your ImageCropDemoSimple Composable and I am getting this error:
java.lang.IllegalArgumentException: height must be > 0 at android.graphics.Bitmap.checkWidthHeight(Bitmap.java:443) at android.graphics.Bitmap.createBitmap(Bitmap.java:872) at android.graphics.Bitmap.createBitmap(Bitmap.java:834) at com.smarttoolfactory.cropper.image.ImageScopeKt.getScaledImageBitmap-pBklqvs(ImageScope.kt:117) at com.smarttoolfactory.cropper.ImageCropperKt$ImageCropper$1.invoke(ImageCropper.kt:67) at com.smarttoolfactory.cropper.ImageCropperKt$ImageCropper$1.invoke(ImageCropper.kt:63) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at com.smarttoolfactory.cropper.image.ImageWithConstraintsKt.ImageLayout-QnyEGeY(ImageWithConstraints.kt:189) at com.smarttoolfactory.cropper.image.ImageWithConstraintsKt.access$ImageLayout-QnyEGeY(ImageWithConstraints.kt:1) at com.smarttoolfactory.cropper.image.ImageWithConstraintsKt$ImageWithConstraints$1.invoke(ImageWithConstraints.kt:119) etc.
Any ideas?
Do you get this error when you select an image with picker?
Do you get this error when you select an image with picker?
Hmm, I guess I don't understand how it works. Is there a wiki or some instructions? Thanks again.
There are no wiki file or instructions. I will add instructions soon. When do you get that exception?
Basically, I'm not sure where in the ImageCropDemoSimple Composable my picked image goes. I thought it was here:
ImageCropper( modifier = Modifier .fillMaxWidth() .weight(1f), imageBitmap = imageBitmap, contentDescription = "Image Cropper", cropStyle = cropStyle, cropProperties = cropProperties, crop = crop, onCropStart = {} ) { pickedImage }
But when I run the code I get the exception I mentioned...
So you run ImageCropDemoSimple and it crashes immediately, right? what's your screen resolution? I will re-write ImageWithConstraints since i need dimensions of Composable and draw area. It returns constraints which are not valid under every condition.
Hi, yes, that's exactly it. I tried using the Pixel 4a emulator (1080x2340). I also tried on my Pixel 7 Pro (1440x3120). Thanks!
also got this error when trying to save cropped image.
BTW, in one screen it works fine, in another FC's.