fix syntax, raise jpeg quality back

This commit is contained in:
IC Rainbow
2024-10-31 18:03:20 +02:00
parent d91bae8c9c
commit 7fee8b0dd5
2 changed files with 3 additions and 2 deletions
@@ -31,6 +31,7 @@ actual fun base64ToBitmap(base64ImageString: String): ImageBitmap {
} catch (e: Exception) { // ByteArrayInputStream returns null
Log.e(TAG, "base64ToBitmap error: $e for \"$base64ImageString\"")
errorBitmap()
}
}
actual fun resizeImageToStrSize(image: ImageBitmap, maxDataSize: Long): String {
+2 -2
View File
@@ -49,12 +49,12 @@ resizeImageToSize toURI maxSize (ResizeableImage fmt img encoder) = either resiz
result = encode $ downscale img m
resizeJPG enc
| minSize > maxSize = halveAndRetry
| otherwise = fitQuality 33 99
| otherwise = fitQuality 50 99
where
encode q
| toURI = toDataUri "jpg" $ enc q img -- the correct mime type is "jpeg", but only "jpg" is supported by older clients
| otherwise = enc q img
minSize = LB.length $ encode 33
minSize = LB.length $ encode 50
fitQuality l u
| u - l <= 1 = encode l -- prefer higher compression
| otherwise =