signalapp / Signal-iOS

A private messenger for iOS.
https://signal.org
GNU Affero General Public License v3.0
10.75k stars 3k forks source link

Signal silently destroys larger PNG images by lossfully compressing them as JPEGs #5850

Open sailbird opened 1 month ago

sailbird commented 1 month ago

Bug description

My boss sent me a series of PNG images to concatenate into a single image. The problem is that some of them (and worse, only some of them) arrived as JPEGs. After a lot of wasted time, I realized that this is the old Signal problem that it destroys PNG data by lossfully compressing it if the original image is a certain size (over 256KB, looks like). Net result is that the images wouldn't line up properly due to compression artifacts, and all in all the result looked unprofessional. It's 2024 and Signal allows people to send videos of many megabytes (albeit also silently degraded by recompression). Why are we still stuck in the dark ages with PNG size limits? And if the size is really such a drag on your servers, then fine: just refuse to send it in the first place, or at least ask if the user is OK converting it to JPEG (with checkbox for "don't ask again"). Maybe I'm being deceived by random luck but I'm pretty sure this is what's going on.

Steps to reproduce

Actual result: Describe here what happens after you run the steps above (i.e. the buggy behaviour)

Expected result: Describe here what should happen after you run the steps above (i.e. what would be the correct behaviour)

Device info

Device: iPhone 15

iOS version: (latest)

Signal version: (latest)

sailbird commented 1 month ago

Related but not equivalent Android issue:

https://github.com/signalapp/Signal-Android/issues/10074

Thireus commented 1 week ago

By default the client app will convert the image. I propose to add an additional option in the settings, we already have "high" quality, we should have "original" quality as well which would not attempt to convert the image.

The code is there for reference:

Not too hard to implement, however there are a few key implications:

I leave it to the devs to comment further on the above.

Temporary solution for your use-case: Zip the images before sending them.