From 7fee8b0dd5ba5d9a2c7bacb8c39d432616849271 Mon Sep 17 00:00:00 2001 From: IC Rainbow Date: Thu, 31 Oct 2024 18:03:20 +0200 Subject: [PATCH] fix syntax, raise jpeg quality back --- .../kotlin/chat/simplex/common/platform/Images.desktop.kt | 1 + src/Simplex/Chat/Image.hs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Images.desktop.kt b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Images.desktop.kt index 7f1884e4f0..ca43ee3c85 100644 --- a/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Images.desktop.kt +++ b/apps/multiplatform/common/src/desktopMain/kotlin/chat/simplex/common/platform/Images.desktop.kt @@ -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 { diff --git a/src/Simplex/Chat/Image.hs b/src/Simplex/Chat/Image.hs index 59f3eb9ca2..61808bc877 100644 --- a/src/Simplex/Chat/Image.hs +++ b/src/Simplex/Chat/Image.hs @@ -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 =