Open hiddeninthesand opened 2 years ago
https://github.com/matrix-org/synapse/pull/7586#issuecomment-638868059 has some thoughts on why this was chosen.
Correct me if I'm wrong, but the comment you linked to says that small size should be chosen over quality, which I agree with, but removing transparency drastically alters a thumbnail compared to the source, and this often isn't even done well. Given how many other services are switching to using WEBPs, users will probably start noticing this deficiency more and more often. I agree that they should be treated as two different algorithms, but as it is right now this should air on the side of caution.
It quite possibly makes sense to check for transparency before just choosing to use jpegs, that would be a nice improvement.
I was mostly attempting to cross-link to the previous conversation about why those defaults were chosen!
I see, thanks for the context though, it definitely helps illuminate the decision making!
As noted in #11899, this also causes lose of animation.
Is this an enhancement? I thought this was a bug.
Is this an enhancement? I thought this was a bug.
This is currently acting as designed, the description for enhancement vs. defect might help:
Enhancement: New features, changes in functionality, improvements in performance, or user-facing enhancements.
Defect: Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
This change probably lives somewhere in-between though and it is a bit of judgement call.
this is still an issue, particularly in conjuction with matrix-appservice-discord which uses webp for user avatars. matrix-media-repo handles this just fine, using png thumbnails for webp images. if you absolutely need lossy compression, you could thumbnail as webp in lossy mode (or jpeg-xl, which supports transparency and is slowly gaining support), but either way it feels very unacceptable to be turning transparent images into black blocky messes.
This is really bad in conjunction with WebP emojis in MSC2545: Image Packs. 😢
This patch seems to work fine:
Related: https://github.com/matrix-org/matrix-spec/issues/453
I was about to say that some platforms (looking at iOS) may not support WebP, but it seems that it is supported since iOS 14.
Description
Exactly as it sounds, WEBPs that have transparency get thumbnailed as JPEGs, making them look terrible. Tracked it down to #4382, where WEBPs were universally marked to use JPEG for thumbnailing instead of PNGs, or WEBPs, though I assume that last one is more of a Synapse limitation than an oversight. Intended behavior is for transparent images to have transparent thumbnails, including WEBPs.
Steps to reproduce
Version information
Homeserver was matrix.org
Version: 1.51.0rc1 (b=matrix-org-hotfixes,7977b7f6a)
Install method: Not sure what they do.
Platform: Not sure.