Convert SVG to JPEG using Imagemagick, lack of external raster graphics

I would like to convert a simple svg graphic file to jpeg. Here is the svg source code:

<svg style="overflow: hidden; position: relative;" 
  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
  width="300" version="1.1" height="200">
     <image x="10" y="10" width="276" height="110" 
     xlink:href="http://images.google.com/intl/de_ALL/images/logos/images_logo_lg.gif"
     stroke-width="1"></image>
  <rect x="0" y="150" height="10" width="300" style="fill: #000000"/>
</svg>

If I do the conversion on my Windows XP machine with ImageMagick 6.7.8, everything works fine.

convert test.svg test.jpg

Conversion with windows

If I do the same conversion on my Linux server (Debian 6.0 ImageMagick 6.6.0), get only a black line.

Conversion on linux server

I tried updating to the latest version of Imagemagick on my linux machine, but I did not get a newer version from the repository.

But I'm not sure if using external images is a feature from a newer version or a configuration problem.

Thanks for any suggestions!

+5
source share
4 answers

You can check your version with

convert --version

:

Version: ImageMagick 6.7.7-0 2012-05-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features:  OpenCL

macports.

:

Version: ImageMagick 6.6.9-7 2012-04-30 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP   

Ubuntu 12.04 LTS ...

+2

Debian , :

  • ImageMagick. .

  • , Debian (.tar.gz).

  • Google Debian Squeeze (a.k.a. 6.0) 'backport'. , , ImageMagick.

+1

@Wolfgang

imagemagick, . ( , , )

$ convert --version
Version: ImageMagick 6.6.9-7 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP 

:

Distributor ID: Ubuntu
Description:    Ubuntu-Secure-Remix 12.04.1 LTS 31.08.2012
Release:    12.04
Codename:   precise

, .

:

rsvg-convert

( Ubuntu):

apt-get install librsvg2-bin

And to convert SVG to PNG, the command:

rsvg-convert your_file.svg > your_file.png
0
source

You can also try Apache Batik SVG Rasterizer

java -jar batik-rasterizer.jar samples/batikFX.svg

It extracts external images.

0
source

All Articles