Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File size increase when sending images #6881

Open
2 tasks done
scy opened this issue May 20, 2024 · 2 comments
Open
2 tasks done

File size increase when sending images #6881

scy opened this issue May 20, 2024 · 2 comments
Labels

Comments

@scy
Copy link

scy commented May 20, 2024

Using a supported version?

  • I have searched searched open and closed issues for duplicates.
  • I am using Signal-Desktop as provided by the Signal team, not a 3rd-party package.

Overall summary

When sending images, Signal re-encodes them, often increasing file size significantly in the process. This is especially annoying if you have optimized the image's file size before sending it.

Steps to reproduce

  1. Create a JPEG image with low quality settings (e.g. 20/100). My example image is 928×640 and 35 K in size. It contains very visible artifacts, but is legible.
  2. Use the paperclip button to attach it to a message.
  3. Select either "standard" or "high" image quality, the file size increase happens in both modes.
  4. Send the image.

Expected result

Since it makes sense for Signal to strip metadata (e.g. location information and serial numbers) from the image, a slight variation in file size (preferably towards the lower end) can be expected.

Actual result

When I use the "download" button to save the image that has been sent, I can see that it's now 79 K in size ("standard" setting). This is more than twice the original size. Loading both images in Python's pillow library and comparing the raw image data (.tobytes(), but also with .getdata()) shows that the raw pixel data has been re-encoded, which likely also reduced the quality.

Using the "high" quality setting in Signal, the image size is changed to 80 K instead. Raw image data still differs, which implies that the image has been re-encoded, too.

For good measure, I've also performed the experiment with a PNG input (275 K originally) instead.

  • "Standard" mode reduces the file size to 77 K, but obviously converts the image to a JPEG in the process. (Note that, for whatever reason, this is 2 K less than what Signal made of the 35 K JPEG input.)
  • "High" mode results in a 345 K image, a 25 % increase.

Screenshots

Not sure whether GitHub will mangle these in some way, but these are my original input images and their SHA-256 hashes.

JPEG

PNG

$ sha256sum lipsum.*
3000ddc8d560fb26e490bc725b6af4d27c46c56e9ea96142be9d2df3b5cf4e72  lipsum.jpg
832588f0b25189ca8a81c5849d6be29accba6738adc3ac2be78557452fe04e34  lipsum.png

Signal version

7.5.1

Operating system

Debian 12 (bookworm) amd64

Version of Signal on your phone

7.7.1

Link to debug log

No response

@scy
Copy link
Author

scy commented May 20, 2024

Forgot to mention in the original report: I saw #5469 when looking for related issues which claims that this is fixed in ≥ 5.15. Maybe it's a regression?

@ayumi-signal
Copy link
Contributor

Thanks for reporting this and for finding the related issue. We will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants