SVG to PNG Conversion Problem with 6.9.7-4

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
aaknitt
Posts: 2
Joined: 2018-03-31T12:23:10-07:00
Authentication code: 1152

SVG to PNG Conversion Problem with 6.9.7-4

Post by aaknitt »

Hello everyone,

I have a weather display setup using a Raspberry Pi and old Kindle similar to the setup described here. The Pi grabs an SVG image from the national weather service and converts it to a PNG that the Kindle can display. I've had this running on an older Pi for a long time with good success. That Pi is running ImageMagick 6.7.7-10. I'm trying to get this setup transferred over to a newer Pi running the latest OS, which installs ImageMagick 6.9.7-4 when I run sudo apt-get install imagemagick. With this version, the SVG to PNG conversion isn't working properly.

For this source SVG, I'm getting this PNG output. As you can see, it's stacking all of the weather icons in the same spot in the upper left without doing the transform operations specified in the SVG file. It's a little hard to tell, but it looks like it may be dumping all of the icons that are defined in the SVG at that location, even if they're not supposed to be displayed at all.

Is there something I need to do differently with 6.9.7-4 to convert SVG to PNG as opposed to 6.7.7-10? Or is this possibly an issue with an external dependency that ImageMagick is using? Any help would be appreciated.

Thanks,

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

Re: SVG to PNG Conversion Problem with 6.9.7-4

Post by fmw42 »

Imagemagick uses RSVG delegate or Inkscape or its own internal MSVG/XML to convert SVG files. The latter is the worse. Inkscape is the best, but RSVG is usually pretty good. But be sure you are using the same renderer in both systems and the latest versions. You can find out by

Code: Select all

convert -list format
and looking at the line for SVG. It will tell you at the end of the line which renderer and what the version is.

Also check that the same versions of libpng are being used and upgrade if possible.

Note that RSVG is a delegate library and will show in

Code: Select all

convert -version
So it needs to be installed and IM compiled afterwards to use it.

IM will use Inkscape if currently on the system and it can find it.

I am not sure whether IM used Inkscape for older systems.

My guess is that your older version used RSVG, but your newer one is using the IM internal renderer. But the information above should tell you what is going on.

Code: Select all

convert weather-script-output.svg x.png
works fine for me on IM 6.9.9.40 Q16 Mac OSX with

SVG SVG rw+ Scalable Vector Graphics (RSVG 2.42.2)
PNG* PNG rw- Portable Network Graphics (libpng 1.6.34)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: SVG to PNG Conversion Problem with 6.9.7-4

Post by snibgo »

As Fred says.

The SVG converts fine for me, with Inkscape as the delegate. When I force the internal MSVG rasterizer...

Code: Select all

convert MSVG:weather-script-output.svg x.png
... I get the same bad result as the OP, with the symbols stacked top-left.
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: SVG to PNG Conversion Problem with 6.9.7-4

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later this week.
aaknitt
Posts: 2
Joined: 2018-03-31T12:23:10-07:00
Authentication code: 1152

Re: SVG to PNG Conversion Problem with 6.9.7-4

Post by aaknitt »

Thanks for the prompt assistance everyone, this should be enough info to get things straightened out when I have a chance to look at it.

Andy
manuelj
Posts: 1
Joined: 2018-04-05T07:36:14-07:00
Authentication code: 1152

Re: SVG to PNG Conversion Problem with 6.9.7-4

Post by manuelj »

Hello @ all,
I'm expericing an issue very similar to this one ... could be the same underlying problem.
My source image: reelworx.svg
Output: test.png

Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org

Code: Select all

     MSVG  SVG       rw+   ImageMagick's own SVG internal renderer
      SVG  SVG       rw+   Scalable Vector Graphics (XML 2.9.4)
     SVGZ  SVG       rw+   Compressed Scalable Vector Graphics (XML 2.9.4)
I tried converting with all 3 renderers, all produced the same output.

My webhoster has updated from ImageMagick 6.8.??? to 6.9.7-4 a few days ago, the issue didn't occur with the old version, the same SVG converted fine.

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

Re: SVG to PNG Conversion Problem with 6.9.7-4

Post by fmw42 »

I only see one renderer -- XML for the IM internal renderer. Try installing RSVG delegate or Inkscape.

This works fine for me

Code: Select all

convert -density 92 reelworx.svg -alpha off result.png

I am using IM 6.9.9.40 Q16 Mac OSX Sierra with RSVG

SVG SVG rw+ Scalable Vector Graphics (RSVG 2.42.2)
Post Reply