Librsvg Segmentation fault - Many images with around 10MB - librsvg

I am trying to render an SVG with 4000x4000 resolution.
The command I am using is:
rsvg --keep-image-data -w 4000 -h 4000 big.svg try.png
An svg sample is:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="406" height="406">
<clipPath id="slot-1">
<rect x="0" y="0" width="45" height="45" />
</clipPath>
<clipPath id="slot-2">
<rect x="0" y="203" width="45" height="45" />
</clipPath>
<image clip-path="url(#slot-2)" x="1" y="170" angle="0" width="80" height="45" preserveAspectRatio="none" xlink:href="file:///var/www/myposter/web/application/../../storage/public/2017/04/0/b/f/8/4/0bf841426d859a99b0736766eca9d353ad9c9fd2_base.jpg" />
<image clip-path="url(#slot-1)" x="1" y="-29" angle="0" width="76" height="45" preserveAspectRatio="none" xlink:href="file:///var/www/myposter/web/application/../../storage/public/2017/04/1/0/9/6/0/10960d9aa853b49dac548887595c829b32aa5107_base.jpg" />
</svg>
The images are from 2MB - 24MB of size.
And in the end the thing crashes and gives me back "Segmentation fault".
If I do the same with a resolution of 1200x1200...
rsvg --keep-image-data -w 1200 -h 1200 big.svg try.png
It works as expected.

The process simply hits the memory limit because there are a lot of high-res images referenced in the svg.
So the solution would be to get more memory or to use lower size images

Related

Image in SVG in HTML not displaying [duplicate]

I cannot get past 2 levels. (Tried on Iceweasel and Chromium.)
As a test, I tried a variant of the code presented in this earlier reply. This one consists of 3 separate files, where a.svg includes b.svg, and b.svg includes c.svg. (NB: This is not a cycle.)
<!-- a.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#b58900" />
<image x="10" y="20" width="80" height="80" xlink:href="b.svg" />
</svg>
<!-- b.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#cb4b16" />
<image x="10" y="20" width="80" height="80" xlink:href="c.svg" />
</svg>
<!-- c.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#dc322f" />
</svg>
I expected to see a large dark yellow dot, a medium-sized orange dot, and a small red dot, but I see only the first two. In fact, what I see is exactly the same as what I would see if b.svg did not include c.svg.
Why is c.svg not being included?
Is there a way to get SVG recursion to work for more than 2 levels?
SVG when used as an image must be complete in a single file.
a.svg is not an image
b.svg is included as an image by a.svg and is therefore subject to the complete in a single file image rule so any images it contains must be included as data URIs.
c.svg is ignored as b.svg cannot refer to external files.
Convert c.svg to a data URI and include it inline in b.svg to get round this.

How can I embed SVG within SVG within HTML? [duplicate]

I cannot get past 2 levels. (Tried on Iceweasel and Chromium.)
As a test, I tried a variant of the code presented in this earlier reply. This one consists of 3 separate files, where a.svg includes b.svg, and b.svg includes c.svg. (NB: This is not a cycle.)
<!-- a.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#b58900" />
<image x="10" y="20" width="80" height="80" xlink:href="b.svg" />
</svg>
<!-- b.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#cb4b16" />
<image x="10" y="20" width="80" height="80" xlink:href="c.svg" />
</svg>
<!-- c.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#dc322f" />
</svg>
I expected to see a large dark yellow dot, a medium-sized orange dot, and a small red dot, but I see only the first two. In fact, what I see is exactly the same as what I would see if b.svg did not include c.svg.
Why is c.svg not being included?
Is there a way to get SVG recursion to work for more than 2 levels?
SVG when used as an image must be complete in a single file.
a.svg is not an image
b.svg is included as an image by a.svg and is therefore subject to the complete in a single file image rule so any images it contains must be included as data URIs.
c.svg is ignored as b.svg cannot refer to external files.
Convert c.svg to a data URI and include it inline in b.svg to get round this.

SVG with image not rendered when reference in img tag [duplicate]

I cannot get past 2 levels. (Tried on Iceweasel and Chromium.)
As a test, I tried a variant of the code presented in this earlier reply. This one consists of 3 separate files, where a.svg includes b.svg, and b.svg includes c.svg. (NB: This is not a cycle.)
<!-- a.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#b58900" />
<image x="10" y="20" width="80" height="80" xlink:href="b.svg" />
</svg>
<!-- b.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#cb4b16" />
<image x="10" y="20" width="80" height="80" xlink:href="c.svg" />
</svg>
<!-- c.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#dc322f" />
</svg>
I expected to see a large dark yellow dot, a medium-sized orange dot, and a small red dot, but I see only the first two. In fact, what I see is exactly the same as what I would see if b.svg did not include c.svg.
Why is c.svg not being included?
Is there a way to get SVG recursion to work for more than 2 levels?
SVG when used as an image must be complete in a single file.
a.svg is not an image
b.svg is included as an image by a.svg and is therefore subject to the complete in a single file image rule so any images it contains must be included as data URIs.
c.svg is ignored as b.svg cannot refer to external files.
Convert c.svg to a data URI and include it inline in b.svg to get round this.

Why image or img no tag is working in svg? [duplicate]

I cannot get past 2 levels. (Tried on Iceweasel and Chromium.)
As a test, I tried a variant of the code presented in this earlier reply. This one consists of 3 separate files, where a.svg includes b.svg, and b.svg includes c.svg. (NB: This is not a cycle.)
<!-- a.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#b58900" />
<image x="10" y="20" width="80" height="80" xlink:href="b.svg" />
</svg>
<!-- b.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#cb4b16" />
<image x="10" y="20" width="80" height="80" xlink:href="c.svg" />
</svg>
<!-- c.svg -->
<svg width="100%" height="100%" viewBox="-100 -100 200 200" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<circle cx="-50" cy="-50" r="30" style="fill:#dc322f" />
</svg>
I expected to see a large dark yellow dot, a medium-sized orange dot, and a small red dot, but I see only the first two. In fact, what I see is exactly the same as what I would see if b.svg did not include c.svg.
Why is c.svg not being included?
Is there a way to get SVG recursion to work for more than 2 levels?
SVG when used as an image must be complete in a single file.
a.svg is not an image
b.svg is included as an image by a.svg and is therefore subject to the complete in a single file image rule so any images it contains must be included as data URIs.
c.svg is ignored as b.svg cannot refer to external files.
Convert c.svg to a data URI and include it inline in b.svg to get round this.

Use a repeating character as table border

I want to create a table with the table border using some repeating character say a $. I want the output to be like
$$$$$$$$$$$$$
$ $
$ asd $
$ $
$$$$$$$$$$$$$
I thought of using pseudo elements but that won't give the desired result.
Is there a way to achieve this using CSS3?
You can do it using svg
<svg width="500" height="500">
<defs>
<pattern id="p" x="0" y="0" width="50" height="50" patternUnits="userSpaceOnUse" >
<text x="0" y="30" font-size="40">$</text>
</pattern>
</defs>
<rect x="0" y="0" width="500" height="500" stroke="url(#p)" fill="none" stroke-width="100"/>