Convert SVG to PNG with text

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
thuyentrang
Posts: 8
Joined: 2018-11-09T11:33:21-07:00
Authentication code: 1152

Convert SVG to PNG with text

Post by thuyentrang »

Hello,

I tried to convert a SVG file with text to a PNG file, but the converted PNG file without the text. I am using Debian 9, ImageMagick 6.9.7-4 and "freetype" is listed in "Delegates".

Sample file: https://dev.w3.org/SVG/tools/svgweb/sam ... es/410.svg

Command:

Code: Select all

convert -density 500 410.svg 410.png
Please help, thank you :D
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG to PNG with text

Post by fmw42 »

Which SVG renderer are you using? Inkscape, RSVG delegate or Imagemagick MSVG/XML. 6.9.7.4 is rather old by version. What is the date associated with the version. Show us the results of

Code: Select all

convert -version
Also check

Code: Select all

convert list -format
and look at the line for SVG. What does it list (for the renderer) at the end of that line?

Using Inkspace with Imagemagick 6.9.10.14 Q16 Mac OSX, it works fine. Using the Imagemagick MSVG/XML renderer if does not snow the letters. Using the RSVG delegate with Imagemagick also works fine.

So I think you likely need to install either Inkscape or the RSVG delegate.

If you just install Inkscape on your system it will be used automatically if your version is 6.7.9-0 or higher.
thuyentrang
Posts: 8
Joined: 2018-11-09T11:33:21-07:00
Authentication code: 1152

Re: Convert SVG to PNG with text

Post by thuyentrang »

:D I am so sorry but I don't know which SVG renderer I am using, can you tell me how to check it. I installed ImageMagick by apt-get command in Debian and did not installed any another libraries:

Code: Select all

apt-get install imagemagick
There are the result of -version and -format:
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Copyright: ยฉ 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
Last edited by thuyentrang on 2018-11-09T13:00:00-07:00, edited 1 time in total.
thuyentrang
Posts: 8
Joined: 2018-11-09T11:33:21-07:00
Authentication code: 1152

Re: Convert SVG to PNG with text

Post by thuyentrang »

Hello, I installed Inkscape and It has worked. Thank you very much for supporting.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG to PNG with text

Post by fmw42 »

Your version is from Jan 14, 2017, so almost 2 years old. You might try upgrading or finding that version with a more current patch date. But I think the issue is really what SVG renderer is being used. I suspect you have only the Imagemagick internal MSVG/XML render and need to install either Inkscape or the RSVG delegate library.

Sorry, I mistyped the command with the format to get the SVG renderer. It should be

Code: Select all

convert -list format
Look for the line starting with SVG and post that back. The end of the line should say either RSVG or MSVG or XML.
thuyentrang
Posts: 8
Joined: 2018-11-09T11:33:21-07:00
Authentication code: 1152

Re: Convert SVG to PNG with text

Post by thuyentrang »

Code: Select all

convert -list format
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)
At this time, maybe my problem has been solved. I don't know if there are any hidden issues, I think I should update ImageMagick now.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG to PNG with text

Post by fmw42 »

You are using the Imagemagick XML internal MSVG renderer, which did not show the text for me on the current IM 6. So your best bet would be to install Inkscape or if you cannot use that, then install the RSVG delegate (librsvg)
thuyentrang
Posts: 8
Joined: 2018-11-09T11:33:21-07:00
Authentication code: 1152

Re: Convert SVG to PNG with text

Post by thuyentrang »

I met some issues while trying install the latest version of ImageMagick, please help me in this topic https://imagemagick.org/discourse-serve ... =1&t=35018 , thank you Fred ๐Ÿ˜ž๐Ÿ˜ž๐Ÿ˜ž
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG to PNG with text

Post by fmw42 »

thuyentrang wrote: โ†‘2018-11-10T13:29:02-07:00 I met some issues while trying install the latest version of ImageMagick, please help me in this topic https://imagemagick.org/discourse-serve ... =1&t=35018 , thank you Fred ๐Ÿ˜ž๐Ÿ˜ž๐Ÿ˜ž
Sorry, I do not know about installing on Debian. I use a Mac and install from MacPorts. You will have to wait for one of the IM developers or some one else to provide help. But you should check the config.log file to see what went wrong. Look for the errors and try to fix them.
thuyentrang
Posts: 8
Joined: 2018-11-09T11:33:21-07:00
Authentication code: 1152

Re: Convert SVG to PNG with text

Post by thuyentrang »

Thank you very much Fred, I've installed successfully :D
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert SVG to PNG with text

Post by fmw42 »

Glad you got it installed. Did you install Inkscape or RSVG to fix your issue?
Post Reply