From eed5c5e74319520e7541102f906e02d81849ad62 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 18 Jan 2022 09:49:10 +0100 Subject: [PATCH] add additional logging to image compression --- .../java/eu/siacs/conversations/persistance/FileBackend.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 48ffae422..a4644fd56 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -746,12 +746,15 @@ public class FileBackend { final int imageMaxSize = mXmppConnectionService.getResources().getInteger(R.integer.auto_accept_filesize); while (!targetSizeReached) { os = new FileOutputStream(file); + Log.d(Config.LOGTAG, "compressing image with quality " + quality); boolean success = scaledBitmap.compress(Config.IMAGE_FORMAT, quality, os); if (!success) { throw new FileCopyException(R.string.error_compressing_image); } os.flush(); - targetSizeReached = file.length() <= imageMaxSize || quality <= 50; + final long fileSize = file.length(); + Log.d(Config.LOGTAG, "achieved file size of " + fileSize); + targetSizeReached = fileSize <= imageMaxSize || quality <= 50; quality -= 5; } scaledBitmap.recycle();