signalapp / Signal-Android

A private messenger for Android.
https://signal.org
GNU Affero General Public License v3.0
25.59k stars 6.14k forks source link

Lower compression for sent pictures #672

Closed ghost closed 8 years ago

ghost commented 10 years ago

It would be nice if pictures which are sent over the data channel aren't so highly compressed.

NeoFromMatrix commented 7 years ago

I have a similar problem in #6262, 3264x2448px, 1.5MB to 408x306 px, 36.4KB

I'd prefer my images not being modified to the point where they are no longer usable.

billie80 commented 7 years ago

You already have been told in #6262 that image compression depends on the memory class of your device. Unless you don't give this information (one of the first lines of the debug log will tell you) nobody will be able to help you. If you own a low memory device the maximum image width is 768 px. Maybe in your case when rescaling one step ended slightly above this value and with the next iteration it ended at 408 px.

NeoFromMatrix commented 7 years ago

Sorry for the inconvenience. I'm a bit confused why this bug is closed, is there no other way to compress the images less on devices with lower memclass, or are you already hitting the border to being usable on those devices? Maybe introduce a finer granulation with memclasses, or increase the MAX_IMAGE_DIMEN_LOWMEM in the PushMediaConstraints file? I'm sorry if this seems naive, I'm not an Android/Java developer and I don't have experience in this field. The way my data is handles in this case i just not usable for my daily use.

Sender:

Device  : samsung GT-I9300 (m0xx)
Android : 4.3 (I9300XXUGOL2, JSS15J.I9300XXUGOL2)
Memory  : 45M (35.55% free, 256M max)
Memclass: 64
OS Host : SWDB4709
App     : Signal 3.28.4

Recipient:

Device  : LGE Nexus 4 (occam)
Android : 6.0.1 (87a9c9942e, cm_mako-userdebug 6.0.1 MOB31K 87a9c9942e test-keys)
Memory  : 44M (34.38% free, 512M max)
Memclass: 192
OS Host : cyanogenmod
App     : Signal 3.29.6
Dyras commented 7 years ago

@NeoFromMatrix You are correct, what you are currently sending is the limit for low memory devices. Any higher and the app crashes during compression.

dkasak commented 7 years ago

Why does the Samsung GT-I9300 have such a low memory class, though? What is the 256M max referring to then?

UNIcodeX commented 7 years ago

Denis, are you able to send a higher quality photo with any other messaging app, such as Facebook messenger or Textra?

On Feb 21, 2017 1:40 PM, "Denis Kasak" notifications@github.com wrote:

Why does the Samsung GT-I9300 have such a low memory class, though? What is the 256M max referring to then?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/WhisperSystems/Signal-Android/issues/672#issuecomment-281456614, or mute the thread https://github.com/notifications/unsubscribe-auth/AH2n-jKGZTakyjTbt_A7GpZTPtp4oSO4ks5rez2rgaJpZM4BkrZo .

dkasak commented 7 years ago

@UNIcodeX I'm personally not affected since I don't own the phone in question, but the owner can indeed send much higher quality photos through WhatsApp at least.

moxie0 commented 7 years ago

I'm willing to try eliminating the low memclass compression category

UNIcodeX commented 7 years ago

I wonder, then, how the other apps are handling low memory class devices.

Perhaps they aren't compressing at all, if compression is such an issue???

Or maybe they're compressing chunks of the file rather than loading it all into memory, and then appending to it.

read x bytes, compress, write x bytes, repeat until done... send.? I haven't looked at the code for how signal is doing this for a while, so maybe that's already being done.

UNIcodeX commented 7 years ago

@moxie0 , off topic, but... Is there anything in the works to allow straight file transfers as well? Maybe there's another issue open, i'll go look.

ka223 commented 7 years ago

@billie80 I already told above.

A lower memclass device (Samsung Ace GT-S5830) is sending better images than a device with a higher memclass. It can not only depend on the memclass.

ghost commented 7 years ago

I went looking for this issue because I noticed that even on my Moto X 2nd Gen, I'm sending pictures via the Signal protocol less than 100Kb in size. Given that RCS is about to become a thing with 10 Mb photo sending, Signal should at the very least compete with 1 Mb photo sending via the Signal protocol. Heck, even 300 Kb images would be an improvement.

We need to drop every factor leading to this overcompression and just have a simple hard limit of 1MB per picture.

jeremymasters commented 7 years ago

One of the things I wondered also was if Signal is using RGB_565 for just the thumbnail or using it in the conversion process. I'd submit we may want to go with ARGB_8888 instead, as the former produces banding in blue skies. Really, maybe we just shouldn't mess with a resize nor format change, at least for the actual photo. @Cormak I wouldn't want a limit of 1MB per file. Not sure why you files are that small, but I like the current top-end where it is, 6MB.

dkasak commented 7 years ago

@moxie0 The current isLowMemory code also seems "wrong". Since Signal sets android:largeHeap, shouldn't it be checking against [getLargeMemoryClass()](https://developer.android.com/reference/android/app/ActivityManager.html#getLargeMemoryClass()) instead? This might explain why some devices which can easily send higher resolution images over (e.g.) Whatsapp get a rather low memory class rating in Signal.

neheb commented 7 years ago

Recent Signal convert says images sent to other Signal users look fine but look terrible through MMS

dkasak commented 7 years ago

This is still a problem. Annoyingly, even the new file transfer functionality resizes images. I would do the change I proposed in my previous comment myself, but I don't have a convenient way of testing it since I don't have a spare phone. Is there a way to test the new build without unregistering/getting a new key?

EDIT: Actually, I think I'll try opening a new issue to get more traction. EDIT (2017-08-12): My suggested change has been merged so this should work better. Waiting for the Play Store release to check.

Sollybird commented 6 years ago

The issue still persists, although images that I send are no longer compressed, and images received/sent between Signal users are fine. However, MMS messages that I receive are no longer legible in any sense of the word - they're just too compressed to read. I've tried other apps like Silence, and they don't appear to have this problem, but Signal is perfect for me in literally every other way.

haffenloher commented 6 years ago

@Sollybird MMS messages that you receive? Are you sure Signal is responsible for that? In any case, if you want the devs to investigate this, please open a new issue.

ghost commented 6 years ago

Apologies for the noob question, but what is the answer to this (have read previous posts though got a little confused)? I own a high-end mobile phone so do I therefore need to amend some code to ensure when an MMS is sent that the quality is good? Thanks in advance.

pkorba commented 5 years ago

I can't complain about image quality of pictures sent as Signal messages over data - they look good. However, images sent over MMS are still overly compressed compared to stock SMS app. Here's my debug log: https://debuglogs.org/a3d3d1b44425bfe13419e160045cd11a99d6d2363cb478af745a8f7ca24666e0

4608x3456 3,8MB image got compressed to 216x288 14,8 kB.

Another image: original image size: 1920x2560 642,7 kB sent using Signal over MMS: 240x320 23,8 kB sent over MMS using stock SMS app: 1920x2560 286,3 kB Carrier: Orange Polska

I have a friend who has the same complaint. His carrier is Play, P4.

jschwender commented 5 years ago

I can confirm that modifying image content is not a good idea: most of my contacts that i asked switching from whatapp to signal refused to use signal as soon as they noticed this specific behaviour. This is a blocker!