ImageMagick (RSVG) will not import images into SVG

I am 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 which method I use, the end result does not include the image. Other SVG elements are displayed correctly.

I tried:

 convert test.svg test.png rsvg-convert -o test.png test.svg 

I tried changing the image path to use the file: ///, absolute paths, remote URLs and URL codes encoded in each of them. I also formatted my file with and without doctype.

I use librsvg 2.36.3 and ImageMagick 6.8.0-10 I was able to use phantomjs to convert them, but seems redundant for this task.

Please, help!

+6
source share
1 answer

Gtk3 was installed for me (or perhaps more specifically "shared-mime-info") (and reinstalling rsvg afterwards AND using the absolute "file: ///" uri for href AND with the image file in the same directory, as the svg file)

Additional info (I'm still confused about what exactly is happening):

  • I think the problem is not with rsvg directly, but with the gdk-pixbuf (2) library

  • I found a place in the code where gdk-pixbuf is used to load an image. I have confirmed (using printf debuggin) that it does not throw an error (it seems that it loads pixbuf just fine), even if the uri in href does not point to the file.

  • the gtk3 dependency should only be needed for the rsvg-view-3 tool, not rsvg, but it seems like this (or one of the dependencies that were extracted when I installed gtk3)

  • It still works even after uninstalling gtk3. It even works after uninstalling gtk3 and then restores rsvg (./configure detects: "gtk3: no"), so I suggest that it should relate to one of the dependencies that were extracted when I installed gtk3:

  • atk-2.10.0-1-i686

  • HiColor-icon-theme-0.12-2-any
  • GTK-update-icon-cache-2.24.22-1-i686
  • libtasn1-3.3-2-i686
  • P11-kit-0.20.1-1-i686
  • GnuTLS-3.2.5-1-i686
  • libcups-1.7.0-1-i686
  • libxinerama-1.1.3-2-i686
  • shared mim-info-1.2-1-i686
  • libgusb-0.1.6-1-i686
  • NSPR-4.10.1-2-i686
  • JS-17.0.0-1-i686
  • polkit-0.112-1-i686
  • shared color profiles-0.1.5-1-any
  • dconf-0.18.0-1-i686
  • colord-1.0.2-2-i686
  • recordproto-1.14.2-1-any
  • libxtst-1.2.2-1-i686
  • in-spi2-core-2.10.1-1-i686
  • b-spi2-atk-2.10.0-1-i686
  • xkeyboard-config-2.10.1-1-any
  • libxkbcommon-0.3.1-1-i686

(I leave them here if this is not the one I identified at the end)

So I tried to remove these depilations in groups and rebuild and test between them. It turns out one of them does the job ...

* shared-mime-info

+1
source

Source: https://habr.com/ru/post/945637/


All Articles