-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
vips fails with SVGs > 10MB #1354
Comments
!!!!! |
Sorry @tokee, I was reeling in horror :) I guess there would need to be a new option to svgload to remove the limit. How about:
Would that work? |
This problem has previously been reported against sharp - see lovell/sharp#1339 (comment) - I took a quick look at the time but IIRC it's not a straightforward change as the |
Thank you for your very fast follow ups, @jcupitt & @lovell! There is also a Wikimedia thread about this which handily provides
to get a sample SVG that fails. That's the one I used for my report above. |
Oh I see, yes you're right @lovell, we'd need to switch to gio for this, ouch. |
By default librsvg blocks SVGs > 10MB for security. This patch adds an "unlimited" flag to remove this check. We have to switch to using gio to get the librsvg API for this This needs testing on the platforms we support. We'll also need to bump the min version of librsvg we require in configure.ac. See #1354
I had a quick hack and I now see:
It'll need some testing. I've not used gio before and I don't know how well it works on macos / windows / freebsd / etc. We'll need to bump the minimum version of librsvg in configure.ac as well. |
Awesome response time! I checked out the branch and it seems to work (Ubuntu). Thanks a lot! There also seems to be a problem with text labels on my SVG graphs that started it all, but I'm pretty sure that's on |
The C:\test-images>vips copy T111815_test.svg[dpi=10] t1.png
glib: XML parse error: Error domain 1 code 77 on line 15 column 287195 of data: Premature end of data in tag svg line 3
C:\test-images>vips copy T111815_test.svg[dpi=10,unlimited] t1.png
(vips:10608): Pango-WARNING **: 15:43:04.035: couldn't load font "Helvetica Not-Rotated 36.25", falling back to "Sans Not-Rotated 36.25", expect ugly output.
(vips:10608): Pango-WARNING **: 15:43:04.049: couldn't load font "Helvetica Not-Rotated 40.830078125", falling back to "Sans Not-Rotated 40.830078125", expect ugly output.
(vips:10608): Pango-WARNING **: 15:43:04.055: couldn't load font "Helvetica Not-Rotated 39.98046875", falling back to "Sans Not-Rotated 39.98046875", expect ugly output.
(vips:10608): Pango-WARNING **: 15:43:04.062: couldn't load font "Helvetica Not-Rotated 37.0498046875", falling back to "Sans Not-Rotated 37.0498046875", expect ugly output. I'm also going to try to test with librsvg v2.40.19 on Windows. Note that according to the librsvg documentation loading an SVG with GIO is the preferred and most resource-efficient way, so this can also be seen as a nice improvement.
|
That's good to know. I was worried that there might be extra linking requirements on some platforms. I'll test on macOS as well. |
It seems to work on macOS too, with both clang and gcc. Should we merge to master? |
I can happily confirm that the experimental version performs perfectly under Ubuntu for our use case: Rendering a 70MB SVG to 25 gigapixel took 1 hour (it seems to be single threaded?) on a 16GB desktop and produced https://labs.statsbiblioteket.dk/linkgraph/1998_to_2003/ which, besides the resolution jump from our previous GraphicsMagic rendered version, also solved some problems we had with font kerning. I remain in awe of your response time and problem solving skills. Thanks again! |
Recent versions of librsvg will thread some operations, like gaussblur, but it's quite limited. It does not support several threads rendering different parts of the image (I think). I'll merge. Thanks for the feedback. |
OK, this will be in 8.9. Thanks! |
Will there be a 'unlimited' flag option for writing out image pyramids (dzsave)? I seem to be encountering a similar message when processing a large .SVG file. |
Yes, it's an option for input, not output, so you just do:
|
I am trying to use
vips
with 30-50MB SVGs, but it fails fast:Looking around, it seems to be a security feature of
rsvg
that caps SVG processing to 10MB SVGs. Running from the command line, the flag--unlimited
can be passed torsvg-convert
to disable this feature and testing locally confirms that it works:I looked in
svgload.c
in thevips
project and it seems that the flag RSVG_HANDLE_FLAG_UNLIMITED can be used to programmatically disable the feature.Alas, my c-skills are nearly non-existing, so I am unable to figure out how to provide the flag in the code. Could this be made into a
vips
feature or is there another way I can bypass the SVG size limitation?The text was updated successfully, but these errors were encountered: