mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
fix syntax, raise jpeg quality back
This commit is contained in:
+1
@@ -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 {
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user