Convert SVG to PNG with special characters

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
amcoello
Posts: 3
Joined: 2017-12-07T19:05:17-07:00
Authentication code: 1152

Convert SVG to PNG with special characters

Post by amcoello »

Hi,

I have the following svg file "in.svg":

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="500" height="200" 'viewBox="0 0 500 200">

<text x="0" y="0" font-size="14">A Á E É</text>
</svg>

In command line: "convert in.svg out.png"

The output file does not correctly represent the special characters of the text.

how can I solve that?

Thank you very much to all!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert SVG to PNG with special characters

Post by snibgo »

What version of IM? On what platform? What delegate is rendering your SVG? What output do you get?
snibgo's IM pages: im.snibgo.com
amcoello
Posts: 3
Joined: 2017-12-07T19:05:17-07:00
Authentication code: 1152

Re: Convert SVG to PNG with special characters

Post by amcoello »

Hi,

The version of IM is:

Version: ImageMagick 6.9.4-9 Q16 i386 2016-06-21 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC
Delegates (built-in): bzlib freetype gslib jng jpeg png ps tiff xml zlib


The platform is Linux (hosting with STRATO).

The output is: AA E A

Characters without accents work well, but those with accents do not show them or show them wrong.

What do you mean by "Which delegate is your SVG representing?"

Thanks!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert SVG to PNG with special characters

Post by snibgo »

On SVG rendering, see http://www.imagemagick.org/Usage/draw/#svg

Does Inkscape correctly process the SVG? If it does, then I suggest you use that as the IM delegate. If it doesn't, there's a problem with your SVG file.
snibgo's IM pages: im.snibgo.com
amcoello
Posts: 3
Joined: 2017-12-07T19:05:17-07:00
Authentication code: 1152

Re: Convert SVG to PNG with special characters

Post by amcoello »

When i put: convert -list delegate | grep svg

The result is:

cdr => "uniconvertor' '%i' '%o.svg'; /usr/bin/mv '%o.svg' '%o"
cgm => "uniconvertor' '%i' '%o.svg'; /usr/bin/mv '%o.svg' '%o"
dot => "dot' -Tsvg '%i' -o '%o"
dxf => "uniconvertor' '%i' '%o.svg'; /usr/bin/mv '%o.svg' '%o"
fig => "uniconvertor' '%i' '%o.svg'; /usr/bin/mv '%o.svg' '%o"
svg => "rsvg-convert' -o '%o' '%i"


How can i use "rsvg-convert' ?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert SVG to PNG with special characters

Post by snibgo »

The last line says that the external delegate for *.svg files is a program called rsvg-convert. If you don't have that program, it won't be used.

I suggest you install Inkscape, which is (as far as I know) the most complete rasterizer of SVG.
snibgo's IM pages: im.snibgo.com
Post Reply