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

Improve the quality of the rendered diagrams #1999

Merged
merged 4 commits into from
Nov 19, 2024
Merged

Conversation

zecakeh
Copy link
Contributor

@zecakeh zecakeh commented Nov 16, 2024

The first commit allows to lazy-load the diagrams, which should improve the loading time of the CS API on mobile. In the process it also improves the alt text of the images.

The second commit serves the diagrams as high-resolution WebPs. Encoding a high resolution diagram as WebP gives a file of approximately the same size as the lower resolution PNG. For maximum compatibility we also serve them as a lower resolution WebP and a fallback PNG. WebP was chosen because it is one of the export formats of draw.io/diagrams.net, and it is widely available in modern browsers.

Pull Request Checklist

Preview: https://pr1999--matrix-spec-previews.netlify.app

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Encoding the high resolution diagram as WebP gives an image of
approximately the same size as the low resolution PNG.
For maximum compatibility we also serve them as low resolution WebP and
PNG.
WebP was chosen because it is a default export format of draw.io, and it
is widely available in modern browsers.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@zecakeh zecakeh requested a review from a team as a code owner November 16, 2024 14:45
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@richvdh richvdh merged commit 9882d95 into matrix-org:main Nov 19, 2024
12 checks passed
@zecakeh zecakeh deleted the images branch November 19, 2024 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants