krille-chan / fluffychat

The cutest instant messenger in the [matrix]
https://fluffychat.im/
GNU Affero General Public License v3.0
1.22k stars 222 forks source link

When sending an image with "Send Image", the file-size can be considerably larger than the original #1341

Open MoonlightWave-12 opened 2 months ago

MoonlightWave-12 commented 2 months ago

Bug Description

I sent an image with the "Send Image"-function, and did choose to not send the original, so that the file-size will be smaller. However, the file-size doubled from 700KB to 1400KB after sending it with FluffyChat.

The image that i sent, already was resized to an appropriate resolution (1600 Pixels on the long sides), using compression with a high quality (JPG, Quality 95, 4:4:4 subsampling, converted with the GNU Image Manipulation Program).

Wether or not the size increases, depends on the image, so here is a test-image, and the result after sending it with "Send Image":

Test-images (~3 MB file-size) Original (0,95 MB - JPG, quality 95, 4:4:4 subsampling, converted with the GNU Image Manipulation Program) --- ![test-image (noise)](https://github.com/user-attachments/assets/8b8edaf7-b8c0-4764-8c49-598f25eac612) After sending it with "Send Image" (1.9 MB) --- ![test-image (noise) - after send image](https://github.com/user-attachments/assets/e6fe1150-2eab-4196-8045-68f48bc2b6cc)

Steps to Reproduce

  1. Open a chat.
  2. Send the test-image attached to this issue with "Send Image".
  3. Make sure that "Send Original" is off.
  4. Tap/Click on the sent image in the chat.
  5. Download the sent image with the button for that.
  6. Compare the file-size of the downloaded image with the original.

Expected Behavior

The converted image should at most be the same size as the original. It should either be compressed more until the size is smaller than the original, or the original image-data should be used instead, to keep the best quality, without increasing the size.

App Version

1.22.0 (Flatpak)

Additional Platform Information

Debian GNU/Linux Testing (Trixie)

Additional Context

No response

everypizza1 commented 2 months ago

It also looks like it's in much lower resolution with that toggle enabled on my machine, does that happen for you too?

MoonlightWave-12 commented 2 months ago

With the "Send Original"-toggle on, the sent image is identical to the original for me.

With the "Send Original"-toggle off, this test-image looks blurrier, but the resolution is the same. I think that is caused by denoising during image-processing (which can reduce the file-size).


There is also issue https://github.com/krille-chan/fluffychat/issues/1307 , which can make it seem like the resolution of sent images is rather low.