-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Convert photo images to JPEG (or WEBP) on image paste #15977
Comments
That's not up to Element but your browser. Try pasting an image into http://madebyevan.com/clipboard-test/ regardless of whether it was originally a JPG or PNG the clipboard your browser exposes only contains a PNG. |
Ah, TIL. :) Nevertheless, it might still be worth it to do some conversion, as it can really save a LOT of bandwidth. I've seen examples of PNG pastes being 10x the size of the same file saved as JPG, with good quality settings. |
I think this is better served by #14047 - rather than converting to a fixed format, giving the option to compress to different sizes is better. No one likes how hi-res images sent by WhatsApp/Facebook/Instagram turn out. |
I think this comparison is out of place here. WhatsApp converts everything to small-size JPG which sucks for hi-res images or illustrations. I'm not sure about Facebook and Instagram but they don't handle things the same as WhatsApp does. As said, WEBP is suitable for both photo-type images and illustrations, and achieves good quality with respect to compressed size for both. I feel like my suggestion hasn't been received correctly. I'm not advocating to "convert everything to a fixed format". I'm merely suggesting to convert images to a different format if that seems beneficial. The example I gave is photo type images being sent as huge PNGs, while they could be a lot smaller, (almost) without loss of quality, as either JPG(2000) or WEBP. Whether this is beneficial for an image can be determined by converting the large PNG buffer to either of those formats, and comparing the resulting buffer's size. If the converted format is more suitable, the converted result should be significantly smaller. Also, as far as I can understand, #14047 actually suggests to compress everything sent through the client, which I think will cause more quality loss in more cases (which you are arguing is bad, and I agree). |
Doing this without the user's explicit intent is not user-friendly, #14047 gives that control to the user. #14047 says
|
I agree; hence my suggestion specifically pertains to pasted image content, not uploaded files.
Ah, I missed that part, that's better indeed. |
Right, but there's no way to know if you are copying from a browser which mangled your jpeg into png or from another application which you explicitly wanted to copy a png from |
That argument is valid the other way around as well; there's no way to know whether the user explicitly wanted to copy something as a PNG (doesn't happen very much I imagine), or just copied an image which was pasted as a PNG because of browser stuff, while it wasn't actually a PNG (I'd say 50% of cases). There is no automated way to know, since everything is pasted as PNG. Pasting or dropping files is distinguishable from pasting image content though, trusting the tool you shared in your first comment. In my case, pasting files doesn't even return anything. Related to #14047: Extending the paste dialog with a form to choose the compression format and size/quality would solve edge cases where the user explicitly wants to send non-optimally compressed PNG content. It should, however, default to the format most optimal (size-wise) for sending the pasted content. For the majority of users, I think this would be fine; preferable even. It will reduce the amount of clicks needed for sending optimally sized images, reduce the amount of bandwidth needed to send and receive the content, and reduce the amount of disk space the system administrator needs for hosting a matrix server. With respect to bandwidth requirements, it is also an accessibility improvement. |
Is your feature request related to a problem? Please describe.
When pasting a photo, it is always uploaded as a PNG, which uses up a lot of bandwidth and is suboptimal for photo type images.
Describe the solution you'd like
Either convert everything to WEBP, which is suitable for illustrations as well as photos, or try converting the pasted (PNG) image to JPG, and use that if it turns out (significantly) smaller.
The text was updated successfully, but these errors were encountered: