librsvg

ImageMagick (RSVG) won't import images in SVG

你说的曾经没有我的故事 提交于 2019-12-01 02:31:16
问题 I'me trying to use ImageMagick to convert SVG files to PNG. The SVG file is as follows: <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> <image xlink:href="picture.jpg" width="200" height="200"/> </svg> No matter what method I use the final result doesn't include the image. Other SVG elements have rendered correctly. I've tried: convert test.svg test.png rsvg-convert -o test.png test.svg I've tried changing the image path to use file:///,

Convert SVG to PNG and maintain CSS integrity

眉间皱痕 提交于 2019-11-30 18:52:54
I am currently using canvg() and Canvas2Image to copy my SVG to a canvas and then convert the canvas to PNG. I would like to maintain the image format and not use PDF. How can I maintain the CSS integrity? Chart is made using NVD3.js. downloadPhoto: function() { var chartArea = document.getElementsByTagName('svg')[0].parentNode; var svg = chartArea.innerHTML; var canvas = document.createElement('canvas'); canvas.setAttribute('width', chartArea.offsetWidth); canvas.setAttribute('height', chartArea.offsetHeight); canvas.setAttribute('display', 'none'); canvas.setAttribute( 'style', 'position:

Convert SVG to PNG and maintain CSS integrity

若如初见. 提交于 2019-11-30 02:40:28
问题 I am currently using canvg() and Canvas2Image to copy my SVG to a canvas and then convert the canvas to PNG. I would like to maintain the image format and not use PDF. How can I maintain the CSS integrity? Chart is made using NVD3.js. downloadPhoto: function() { var chartArea = document.getElementsByTagName('svg')[0].parentNode; var svg = chartArea.innerHTML; var canvas = document.createElement('canvas'); canvas.setAttribute('width', chartArea.offsetWidth); canvas.setAttribute('height',

rsvg doesn't render linked images

Deadly 提交于 2019-11-29 14:03:17
I use the python rsvg bindings to render an svg image into cairo and save to file, which mostly works. But if the svg file contains a linked image, like so: <image href="static/usrimgs/tmpDtIKpx.png" x="10" y="10" width="600px" height="400px"></image> the image doesn't show up in the final file (the rest of the svg renders just fine). The relative path is correct based on where the script is running, but I'm guessing there's some problem with the fact that it would normally be a relative URL, not a relative filepath. How do I get around this? There are many factors which must be satisfied for

Error with Python ctypes and librsvg

只谈情不闲聊 提交于 2019-11-28 12:33:03
I'm trying to wrap basic function of librsvg with ctypes for Python, but I'm getting a segfault. C: // pycairo excerpt typedef struct { PyObject_HEAD cairo_t *ctx; PyObject *base; /* base object used to create context, or NULL */ } PycairoContext; // librsvg excerpt RsvgHandle * rsvg_handle_new_from_file (const gchar * file_name, GError ** error); // ... gboolean rsvg_handle_render_cairo (RsvgHandle * handle, cairo_t * cr); Python ctypes: from ctypes import * from ctypes import util librsvg = cdll.LoadLibrary('/brew/lib/librsvg-2.2.dylib') libgobject = cdll.LoadLibrary('/brew/lib/libgobject-2

rsvg doesn't render linked images

回眸只為那壹抹淺笑 提交于 2019-11-28 07:58:31
问题 I use the python rsvg bindings to render an svg image into cairo and save to file, which mostly works. But if the svg file contains a linked image, like so: <image href="static/usrimgs/tmpDtIKpx.png" x="10" y="10" width="600px" height="400px"></image> the image doesn't show up in the final file (the rest of the svg renders just fine). The relative path is correct based on where the script is running, but I'm guessing there's some problem with the fact that it would normally be a relative URL,

Error with Python ctypes and librsvg

天涯浪子 提交于 2019-11-27 07:08:48
问题 I'm trying to wrap basic function of librsvg with ctypes for Python, but I'm getting a segfault. C: // pycairo excerpt typedef struct { PyObject_HEAD cairo_t *ctx; PyObject *base; /* base object used to create context, or NULL */ } PycairoContext; // librsvg excerpt RsvgHandle * rsvg_handle_new_from_file (const gchar * file_name, GError ** error); // ... gboolean rsvg_handle_render_cairo (RsvgHandle * handle, cairo_t * cr); Python ctypes: from ctypes import * from ctypes import util librsvg =