fixed a bug

This commit is contained in:
2026-08-07 16:06:43 +08:00
parent ddfb57c02c
commit c79c34895c
8 changed files with 470 additions and 75 deletions

View File

@@ -8,10 +8,10 @@ import androidx.camera.core.ImageProxy
@ExperimentalGetImage
object ImageUtils {
fun imageProxyToBitmap(imageProxy: ImageProxy): Bitmap {
fun imageProxyToBitmap(imageProxy: ImageProxy, applyRotation: Boolean = true): Bitmap {
val image = imageProxy.image ?: error("ImageProxy does not contain an image.")
val bitmap = yuv420ToBitmap(image)
if (imageProxy.imageInfo.rotationDegrees == 0) {
if (!applyRotation || imageProxy.imageInfo.rotationDegrees == 0) {
return bitmap
}
val matrix = Matrix().apply {