convert SVG to PNG (textPath)

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?".

convert SVG to PNG (textPath)

Postby ph7 » 2007-12-10T15:30:54+00:00

Hello,

im trying to convert a svg file to png under Linux (Debian)
Almost every thing works fine.
I only have a problem with the tag "textPath".
After convert from svg to png the text is not printed along the path. (see below)

Is this a problem which will be fixed in the future? (I'm runing 6.2.4.5)

Code: Select all
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="1000px" height="707px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
   <path id="MyPath" d="M 599,455 A 244,244 0 0,1 723,578" />
</defs>
<use xlink:href="#MyPath" fill="none" stroke="red"  />
<text font-family="Verdana" font-size="42.5" fill="blue" >
<textPath xlink:href="#MyPath">
 We go up, then we go down, then up again
</textPath>
</text>
</svg>

http://creatiese.com/test.svg
http://creatiese.com/test.png


Thanks
ph7
 

Re: convert SVG to PNG (textPath)

Postby anthony » 2007-12-11T18:11:34+00:00

textPath is not implemented in the built-in SVG converter of IM. However if available IM will use the libRSVG library to do SVG conversion, and this does get it right.

Also a perl module has been release to externally implement text path using Perl-Magick
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/
User avatar
anthony
 
Posts: 8687
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia

Re: convert SVG to PNG (textPath)

Postby ph7 » 2008-02-13T12:08:45+00:00

I built a package (configure, make, make install) with the same result.
Below I a list with the settings. What else could be wrong?
Any idea?

Thanks

Code: Select all
Host system type : i686-pc-linux-gnu

                  Option                        Value
-------------------------------------------------------------------------------
Shared libraries  --enable-shared=yes           yes
Static libraries  --enable-static=yes           yes
Module support    --with-modules=yes            yes
GNU ld            --with-gnu-ld=yes             yes
Quantum depth     --with-quantum-depth=16       16
High Dynamic Range Imagery
                  --enable-hdri=no              no

Delegate Configuration:
BZLIB             --with-bzlib=yes              yes
DJVU              --with-djvu=no                no
DPS               --with-dps=yes                no
FlashPIX          --with-fpx=yes                no
FontConfig        --with-fontconfig=yes         yes
FreeType          --with-freetype=yes           yes
GhostPCL          None                          pcl6 (unknown)
Ghostscript       None                          gs (8.54)
result_ghostscript_font_dir='none'
Ghostscript fonts --with-gs-font-dir=default
Ghostscript lib   --with-gslib=yes              no
Graphviz          --with-gvc=yes                no
JBIG              --with-jbig=yes               no
JPEG v1           --with-jpeg=yes               yes
JPEG-2000         --with-jp2=yes                yes
LCMS              --with-lcms=yes               yes
Magick++          --with-magick-plus-plus=yes   no (failed tests)
OpenEXR           --with-openexr=yes            no
PERL              --with-perl=yes               /usr/bin/perl
PNG               --with-png=yes                yes
RSVG              --with-rsvg=yes               yes
TIFF              --with-tiff=yes               yes
result_windows_font_dir='none'
Windows fonts     --with-windows-font-dir=
WMF               --with-wmf=yes                yes
X11               --with-x=                     yes
XML               --with-xml=yes                yes
ZLIB              --with-zlib=yes               yes

X11 Configuration:
      X_CFLAGS        =
      X_PRE_LIBS      = -lSM -lICE
      X_LIBS          =
      X_EXTRA_LIBS    =

Options used to compile and link:
  PREFIX          = /usr/local
  EXEC-PREFIX     = /usr/local
  VERSION         = 6.3.7
  CC              = gcc
  CFLAGS          = -g -O2 -Wall -W -pthread
  MAGICK_CFLAGS   = -g -O2 -Wall -W -pthread
  CPPFLAGS        = -I/usr/local/include
  PCFLAGS         =
  DEFS            = -DHAVE_CONFIG_H
  LDFLAGS         = -lfreetype -lz
MAGICK_LDFLAGS  = -L/usr/local/lib -lfreetype -lz
  LIBS            = -lMagick -llcms -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lpthread
  CXX             = gpp
  CXXFLAGS        = -pthread
ph7
 

Re: convert SVG to PNG (textPath)

Postby tsdineen » 2008-02-14T07:19:10+00:00

Try the latest 6.3.8 version. There was a small change to the svg lib, that may help your cause.
tsdineen
 
Posts: 66
Joined: 2007-01-18T08:45:31+00:00

Re: convert SVG to PNG (textPath)

Postby ph7 » 2008-02-14T13:00:18+00:00

Thanks for the advise. I tried today 6.3.8 version but with almost the same result
http://creatiese.com/test.svg
http://creatiese.com/test.png
It seems that the bugfix (Set RSVG base URI (patch provided by tsdineen).) helped a bit.
Can it be, that imagemagick has a problem to match "textPath" and "path" by id?

Thanks
ph7
 

Re: convert SVG to PNG (textPath)

Postby tsdineen » 2008-02-15T07:58:13+00:00

What happens when you use rsvg directly?

rsvg test.svg test.png

It's possible that there is some missing initialization code in the svg.so that may be in th rsvg main code.
tsdineen
 
Posts: 66
Joined: 2007-01-18T08:45:31+00:00

Re: convert SVG to PNG (textPath)

Postby ph7 » 2008-02-16T17:05:09+00:00

Thanks for the tip.
There were no runtime script under the "librsvg2-dev" debian package.
So I installed librsvg-2.20.0 from source and got the same result ('rsvg test.svg test.png' =>no Text around the graph) with no warnings.
It seems that the problem comes with the rsvg package and not with ImageMagick.

At the end I tried to convert svg to png with inkscape and it works.

Has someone successful convert svg (with textPath) to png under ImageMagick? I'm not quit sure if that is generell problem or just a wrong configuration of my server.

For the moment I have a solution (inkscape), but I still like to find the real cause.

Thanks
ph7
 

Re: convert SVG to PNG (textPath)

Postby tsdineen » 2008-02-18T08:20:35+00:00

I've not tried the converion you mentioned, but I am also using a different version of rsvg. I believe I am using the last verison before they started using Cario, which is 2.12.7.
tsdineen
 
Posts: 66
Joined: 2007-01-18T08:45:31+00:00

Re: convert SVG to PNG (textPath)

Postby anthony » 2008-02-20T17:53:27+00:00

ph7 wrote:There were no runtime script under the "librsvg2-dev" debian package.

The run time programs are often installed using a different package to the library itself. Under fedora they are part of the library package but that may not be the case under debian.

Fedora package included the programs, rsvg, rsvg-convert, rsvg-view, along with the library.

My version of IM also did not convert the text in the SVG provided. But then neither did RSVG, which is not suprising, considering that my IM uses the same library.

The RSVG is a full SVG implementation and I have see it do text paths, so I say something is wrong with the SVG, even though my firefox offical Adobe implementation displays it as expected.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/
User avatar
anthony
 
Posts: 8687
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia


Return to Users

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 13 guests