-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Rework 'make generate-images' #12316
Conversation
071ccef
to
bd89078
Compare
Thanks for this PR as this will fix my initial problem. (#12314) But isn't it a bit overkill to download chromium just to build a bunch of png images? Why not use the original SVG image instead of the PNG images? logo.svg: 5.6K (base image size) In some cases, the resulting PNG files are much bigger than the original SVG file, even after compression. I see that favicon and apple-touch-icon have to be a rasterized, but using the SVG for the larger variants might reduce the amount and size of transmitted images. |
Probably is, but Probably possible to use https://github.com/lovell/sharp but it'll be more involved.
I agree we should ideally only use the SVG image in the UI but it'd be quite a bit of work and I think some parts of the code can only work with bitmap images (avatar) and then there's the issue that not every image can be represented as an SVG (think photos). |
4be6fe9
to
aef8d48
Compare
Updated to use a node script and two npm modules in place of previous Chromium-based solution. It uses JSDOM's canvas renderer under the hood whose SVG implementation is probably not as complete as Chrome's but seems to work fine for our logo. Those modules are now only installed on demand, otherwise we would gain 215 new transitive Reviewers should check the diff on |
I like this better, thanks! |
You could just use domxml to remove layer in svg before generating gitea-sm |
xmldom you mean? Yeah, certainly possible and probably better than the string modification. I'm still contemplating whether to add the dependencies to |
I think I will actually do the layer removal but only for the favicon because that is rendered the smallest (16px):
Regarding |
Yes, xmldom :) It's already dependency for svg2img so that would not add much to node_modules size |
Done. Detail is now removed from |
- Remove external dependencies and replace it with a node script that does does the same. - Move detail removal from gitea-sm.png to favicon.png - Remove favicon.ico and its generation, it is unused and we already serve favicon.png in its place. Fixes: go-gitea#12314
0448d59
to
9e1edbf
Compare
Updated to use |
Fixes: #12314