-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Description
I am using your libraries without any issues.
However, I noticed that the cropping is not happening exactly where I want it.
For instance, I'm using your library to crop a part of a text and recognize the text.
But it doesn't crop exactly where I want, and I have to adjust it further down; otherwise, the text doesn't fully appear in the crop.
Do you know how I can solve this?
My code:
@Composable
internal fun ScreenShotCropImage(
isCrop: Boolean,
modifier: Modifier = Modifier,
imageBitmap: ImageBitmap? = rememberImageBitmap(),
onCropImageResult: (ImageBitmap?) -> Unit,
) {
val handleSize: Float = LocalDensity.current.run { 20.dp.toPx() }
val cropProperties by remember {
mutableStateOf(
CropDefaults.properties(
contentScale = ContentScale.Inside,
cropOutlineProperty = CropOutlineProperty(
OutlineType.Rect,
RectCropShape(0, "Rect"),
),
aspectRatio = aspectRatios[3].aspectRatio,
handleSize = handleSize,
overlayRatio = 0.2f,
maxZoom = 4f,
),
)
}
val cropStyle by remember {
mutableStateOf(
CropDefaults.style(drawGrid = false, strokeWidth = 2.dp),
)
}
imageBitmap?.let { image ->
ImageCropper(
modifier = modifier
.fillMaxWidth(),
imageBitmap = image,
contentDescription = null,
cropStyle = cropStyle,
cropProperties = cropProperties,
crop = isCrop,
onCropStart = {},
onCropSuccess = onCropImageResult,
)
}
}Metadata
Metadata
Assignees
Labels
No labels