Skip to content

Doesn't render <image> in output #8

Description

@psimyn

Using a data-uri as xlink:href, I am able to render/return an svg, which I can convert to png successfully using convert in shell. But when calling render the image disappears, with apparently no errors.

var svg = ' \
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100" height="100"> \
      <image xlink:href="data:image/jpg;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" x="0" y="0" width="100" height="100" /> \
    </svg>';

// this returns a working image
// res.set('Content-Type', 'image/svg+xml');
// return res.send(svg);

res.set('Content-Type', 'image/png');
var newsvg = new Rsvg(svg);

var svgString = newsvg.render({
  format: 'png',
  width: 100,
  height: 100
}).data;

return res.send(svgString);

Happy to know if I am doing something completely wrong

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions