Page 1 of 1
svg to png not converting text
Posted: 2008-09-30T12:51:12-07:00
by kruser
Hello,
I am attempting to convert a svg file to png. Imagemagick converts the rectangle but not the text. Is my server install no good or ?
svg file:
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="490" height="500" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g style="fill:#FFFF00;stroke:#FFFF00;opacity:1;">
<rect x="0" y="0" width="480" height="100" rx="10" ry="10" />
</g>
<g style="fill:none;stroke:#006400;stroke-width:2;stroke-opacity:1;">
<rect x="6" y="6" width="468" height="88" rx="10" ry="10"/>
</g>
<g style="font-family:arial;font-size:12;">
<text x="28" y="65" >Hello World</text>
</g>
</svg>
Regards,
Randy
Re: svg to png not converting text
Posted: 2008-09-30T16:59:32-07:00
by magick
Type
Is Freetype associated with the DELEGATES tag? Its required for proper font rendering. If Freetype is not available, ImageMagick reverts to Postscript fonts which requires the Ghostscript delegate library or program (i.e. gs).
We did try your SVG with ImageMagick 6.4.4-1, the current release, and it rendered properly without complaint.
Re: svg to png not converting text
Posted: 2008-10-01T13:22:38-07:00
by kruser
Magic,
Thanks for the reply. Have been working on this all day. Could not get ImageMagick to convert svg to png with my current host. So I opened a new account with one of the biggest hosting companies to test this on their server. Guess what? It does not convert the svg text. It converts the rectangles but not the text.
Someone please try a convert on your system with the above svg file, then view the new png image to see if the text is in the new image file? If it works with your hosting company, please give me their name.
I would like to check for Freetype but I do not know how to use the command line.
Best Regards,
Randy
Re: svg to png not converting text
Posted: 2008-10-01T18:34:29-07:00
by anthony
Look at Rubble Web, which shows how you can run various convert from PHP to find out the build information for the IM "Convert" command you are using.
Without more information it is very difficult to help.
Re: svg to png not converting text
Posted: 2008-10-02T06:49:47-07:00
by kruser
Anthony,
Thanks for the suggestion to look at the Rubble website as it does contain good information on using PHP to access ImageMagick. One of the pages I found useful was
http://www.rubblewebs.biz/imagemagick/b ... xplain.php
Best Regards,
Randy
Re: svg to png not converting text
Posted: 2008-10-02T10:42:28-07:00
by kruser
Was able to use php to view list configure.
results
Code: Select all
# Path: /usr/lib/ImageMagick-6.0.7/config/configure.mgk
#
# Name Value
# -------------------------------------------------------------------------------
# CC gcc
# CFLAGS -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -Wall -pthread
# CONFIGURE ./configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --with-perl --with-x --with-threads --with-magick_plus_plus
# COPYRIGHT Copyright (C) 1999-2004 ImageMagick Studio LLC
# CPPFLAGS -I/usr/include
# CVS_BRANCH_TAG HEAD
# CXX g++
# CXXFLAGS -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -pthread
# DISTCHECK_CONFIG_FLAGS --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --with-perl --with-x --with-threads --with-magick_plus_plus'CFLAGS=-O2 -g -pipe -m32 -march=i386 -mtune=pentium4'
# EXEC-PREFIX /usr
# HOST i686-redhat-linux-gnu
# LDFLAGS -L/usr/lib -L/usr/X11R6/lib -lfreetype -lz -L/usr/lib
# LIB_VERSION 0x607
# LIB_VERSION_NUMBER 6,0,7,1
# LIBS -lMagick -ltiff -lfreetype -ljpeg -lpng -ldpstk -ldps -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lm -lpthread
# NAME ImageMagick
# PREFIX /usr
# QuantumDepth 16
# RELEASE_DATE 03/07/07
# VERSION 6.0.7
# WEBSITE http://www.imagemagick.org
How do I tell if the Freetype is associated with DELEGATES
Regards,
Randy
Re: svg to png not converting text
Posted: 2008-10-02T11:55:17-07:00
by fmw42
what PHP code did you use? your results are missing the line that starts with DELEGATES
put
convert -list configure
into your exec command or whatever you are using. Then you should get a line in the resulting printout that looks something like:
DELEGATES bzlib fontconfig freetype gs jpeg jp2 lcms lqr openexr png tiff x11 xml zlib
If you have installed ghostscript and freetype to IM's satisfaction, then you should see "freetype gs" included in the list
Re: svg to png not converting text
Posted: 2008-10-02T13:59:40-07:00
by kruser
The PHP script I used is
Code: Select all
<html>
<head>
<title>Test for ImageMagick list configure</title>
</head>
<body>
<?
function alist ($array) {
$alist = "<ul>";
for ($i = 0; $i < sizeof($array); $i++) {
$alist .= "<li>$array[$i]";
}
$alist .= "</ul>";
return $alist;
}
exec("convert -list configure", $out);
echo alist($out);
?>
</body>
</html>
I have no idea why DELEGATES is not there.
Regards,
Randy
Re: svg to png not converting text
Posted: 2008-10-02T15:52:28-07:00
by fmw42
Your version is VERSION 6.0.7, which is extremely OLD. Perhaps you should update. The DELEGATES line may have changed since your version. Your version shows:
# LIBS -lMagick -ltiff -lfreetype -ljpeg -lpng -ldpstk -ldps -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lm -lpthread
Which may now be replaced with Delegates???
I suggest you upgrade to the latest version (6.4.4-1), about 400 minor releases newer.
Seems like you are missing ghostscript from the above list. So you may want to add that along with all the other (upgraded) delegates.
Re: svg to png not converting text
Posted: 2008-10-02T16:44:49-07:00
by kruser
Thanks for the update suggestion. Appreciate it!
Regards,
Randy