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

Mask is base64-encoded, increasing file size #42

Open
jimjam-slam opened this issue Oct 9, 2023 · 3 comments
Open

Mask is base64-encoded, increasing file size #42

jimjam-slam opened this issue Oct 9, 2023 · 3 comments

Comments

@jimjam-slam
Copy link

Just a follow up from #41 here regarding the circular masks in our flag SVGs:

The flags are quite a bit larger after processing—about 15-18 KB each, compared to less than 1 KB before processing. That's mostly because the mask (a black circle) is being base-64 encoded.

For example, in au.svg, here's the mask before processing with {rsvg}:

<mask id="a"><circle cx="256" cy="256" r="256" fill="#fff"/></mask>

And here it is after:

<image id="image293" width="512" height="512" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABmJLR0QA/wD/AP+gvaeTAAAgAElEQVR4nO3dd5hedZ338XcmPaSREJAiXUBEEBAQRRAERUVABOtiwcKj+Kyou+uW53KLvVzKqqugrg1FpYgFF1lQRKlCKCKhSEeEBCQJmYS0SZ4/fjNkMplyl3PO95T367rONUMy97k/RMzve39/5YxDUtlNBOYBW/Zfs/uvzQd9PwvYDJjW/3VS/69N6P862PT+ew62Bugd8mtLgD5gKbAaWA6s6P+6ZMi1uP/rIuCx/q9rO/43lpS7cdEBpIabB2wHPBPYvv/77YBtSYP9vP6rigYKgceAPwMP9399AHio//vHw9JJDWcBIOVrPGlg3xXYZZivU+OilcJTwN3APf1fB3//ILAuLppUbxYAUna2AfYEnjPo6/NILXm1bzWpELgNWDDo6x2kqQlJXbAAkNo3EdgN2H/QtS9p/l35WwP8CZg/6LqRtD5BUossAKTRjSd9mj8IeAFwIPBs0uI6lcdaUnfg98C1wHX9/+wUgjQCCwBpYzOBQ4AXAQcDzwdmhCZSp54EricVBFcBVwLLQhNJJWIBoKabQfp0fyRp4D+QTbfIqR76gDtJhcBl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0n77u/uvewZ9/zC28KXcWABIsTYnFQg7kB6FvF3/122ArYB5/VdPVMAOrQMe678WAn8BHuq//gw80P/9kqiAUtNZAEjlN54NhcA80jMQZg9zTSN1FKYAU0kHHk0i7WIYXEAM/P5gTwErB/3zOtJxt6tJK+dXkFryy/q/XzLoWjzo68Cgvwjb9FKp/X80R2Vl9WAniQAAAABJRU5ErkJggg=="/>
<mask id="mask0">
  <g filter="url(#alpha)">
<use xlink:href="#image293"/>
  </g>
</mask>

It could be that this is required on Cairo's side for rendering in R and is hence a wontfix, and it's not really a problem as far as our package is concerned (except for folks rendering all the way out to SVG, perhaps), but it does blow the size out quite a lot!

@jeroen
Copy link
Member

jeroen commented Oct 9, 2023

I don't think this is something we control in the R package. You may have to ask this upstream at the librsvg repo or maybe we can ask @federicomenaquintero.

Basically the R package calls cairo_svg_surface_create_for_stream and then rsvg_handle_render_document to render the svg back to an svg output stream. So somewhere they changed something.

The Windows binaries use cairo 1.18 and the MacOS binaries still use cairo 1.16. So if the same problem happens on both win and mac, then issue is probably not a regression in cairo, but a change in librsvg.

@federicomenaquintero
Copy link

Cairo's SVG surface creates pretty horrible SVG documents 😃 I haven't read its source code to see exactly what it does, but there's a lot of masking and compositing done by hand, and I don't quite understand it.

(That said, librsvg should be able to render Cairo's SVGs just fine - if it doesn't, it's probably a bug.)

However... are you taking SVGs and then rendering them with librsvg/cairo again to SVG? What's the reason for that?

@jimjam-slam
Copy link
Author

@federicomenaquintero With the {ggflags} package, we ingest SVG flags on package build to store internally in the package, then render them in ggplot2.

For the build process, we were previously running the flags through grConvert::convertPicture() to ensure they were Cairo-compatible, before storing them with grImport2::readPicture(). But grConvert is no longer maintained, so we're switching that out for rsvg::rsvg_svg(), which is maintained and uses the same underlying library (librsvg).

When the plot is created, the user could render out to a raster format like PNG, or they could render back out to a vector format like SVG.

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

No branches or pull requests

3 participants