Does librsvg support the <image> element?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
aharper
Posts: 3
Joined: 2017-03-28T08:53:41-07:00
Authentication code: 1151

Does librsvg support the <image> element?

Post by aharper »

We have a product that dates back to 2005 or earlier that uses librsvg. It seems that whatever version of librsvg we currently use does not support the "image" element. See sample of image element form a real SVG message below.

Should librsvg support this capability, and if so in what version. The hr = m_RenderSVGDocument() method fails on the element shown below. However it does return a successful hr if the href is pointing to a local graphics file, but the mage in the file is not rendered in the final output.

Also, should this element support locally stored graphics files ( png, bmp, jpg, etc ) in the href attribute?

<image x='2mm' y='10mm' width='25mm' height='55mm' xlink:href='http://epaxbeta.lanchile.cl/cusskiosk/d ... umnCount=6'/><!-- Left part -->

Any help appreciated.

Al Harper
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Does librsvg support the <image> element?

Post by fmw42 »

Would be best if you provide your IM version and platform? And an example of the command line you used. I do not know much about SVG files. Are you following the SVG standards in your SVG file? Perhaps show the whole SVG file, so others can test.

What do you get from

Code: Select all

convert -list format
for SVG. It should tell you the version of RSVG used.

Likewise,

Code: Select all

convert -version
will identify the IM version.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Does librsvg support the <image> element?

Post by snibgo »

This is an ImageMagick forum, not a librsvg forum. Questions about the capabilities of libsrvg, and what it should support, might get a better response if directed to libsrvg maintainers.

However, ImageMagick does use libsrvg as an internal delegate. A simple test, with an SVG file with "<image xlink:href="r.jpg>"", where r.jpg is a local file, converts as expected using RSVG. (It also converts correctly with MSVG.)

Tested with IM 6.9.5-3 RSVG 2.40.15.
snibgo's IM pages: im.snibgo.com
aharper
Posts: 3
Joined: 2017-03-28T08:53:41-07:00
Authentication code: 1151

Re: Does librsvg support the <image> element?

Post by aharper »

I'm desperately trying to find the librsvg maintainers. Imagemagick is the closest website I've come to that seems to have any decent content about librsvg. I guess I will search elswhere.

Al
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Does librsvg support the <image> element?

Post by snibgo »

Sorry, I don't know internals of rsvg. Someone else might.

RSVG (and MSVG) correctly render this SVG file, which links to a local JPG and an http JPG:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   width="750px"
   height="1100px"
   id="svg2"
   version="1.1"
  >
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <image
     xlink:href="r.jpg"
     width="70"
     height="46"
     preserveAspectRatio="none"
     id="image4143"
     x="365.84741"
     y="666.83051" />
  <image
     y="117.79662"
     x="80.508469"
     id="image4154"
     xlink:href="http://im.snibgo.com/invcomp_trailer.jpg"
     preserveAspectRatio="none"
     height="100"
     width="100" />
</svg>
snibgo's IM pages: im.snibgo.com
Post Reply