-
Notifications
You must be signed in to change notification settings - Fork 905
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
Use SVGs instead of PNGs for interface icons where possible #4775
Conversation
Nice to have minified svg in the repo, but they are minified in the build pipelines since years. |
Yes, I noticed. But the compression is not working well because the SVG icons contain many other elements that are not visible to the user, including raster images. Currently on https://www.openstreetmap.org: This saves more than 50% transfer size for just the OSM logo. |
Apart from the size of the SVG, many contain information about the users who created the files, including much inkscape metadata, e.g. https://github.com/openstreetmap/openstreetmap-website/blob/master/app/assets/images/osm_logo.svg?short_path=2919c14#L18. This information is also published to the internet: https://www.openstreetmap.org/assets/osm_logo-4afddaae0230a5a46687fdc751ed256dfdccde144118cb02a7d7960f207a4b92.svg ( |
Related #3481 |
Right but is the answer to that a better compressor, or a better compressor configuration maybe? |
Why does it have to be one pull request with everything? Surely it's possible to change the OpenID icon without changing the sign up globe illustration. Some images are simple enough, others are complicated. If you look at globe images in this PR and compare them with what's currently deployed, you'll be able to see some differences. |
See #4671 (comment) for avatar images. Have you tested your changes with Gravatar? |
Also see https://www.caniemail.com/search/?s=svg if you're changing the mailer output. |
Good point, I will revert the e-mail related changes and keep the PNGs there. |
I mentioned this in the pull request:
I can split the pull request per image if the reviewers/maintainers prefer that. |
The default Avatar does not work for me locally using the I tried manipulating the URL to use the published SVG from the current website, and indeed it seems that Gravatar does not like SVGs.... Good call, I will revert the Gravatar changes as well... |
Looks like there was no attempt to convert app/assets/images/confirm-illustration.png. It would be nice if all of those globe images were cropped to 200px height or shorter (this is the min height of their container in css) and ~530px width and their bottom and right sides aligned with the image edges. |
I will split off as many of the separate icons into separate pull requests.
Yes I can do that |
Split off all sections into separate pull requests:
Closing this one |
Part of #850
This pull request replaces PNG icons with their minimized SVG variants, to ensure screens with high pixel densities can display the OpenStreetMap website with beautiful graphics.
Split off pull requests:
Avatar default icons(does not work with Gravatar)For each of the icons, I replaced the PNG with the corresponding SVG. The PNG variant has been removed. Also, I simplified and minimized the SVGs for improved compression and less data transfer. This also removes privacy sensitive information from the SVG files.
In all cases, I can create separate pull requests if that makes the review process easier.
Let me know if I can add more changes to this pull requests for the remaining images, or if I should create separate pull requests.
Browser support
I could not find documentation about which browsers are supposed to be supported by the OpenStreetMap website.
Internet Explorer 11 is the only browser that might have problems displaying SVG graphics related to scaling. This browser is no longer supported.
See https://caniuse.com/svg
In particular I removed the
srcset
for replacing a PNG icon with an SVG icon, because browsers can display SVG icons as source in<img>
.