469,290 Members | 1,820 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,290 developers. It's quick & easy.

SVG->PNG image conversion

Hi all,

I don't have ImageMagick installed currently (and not sure if this has the
ability or not anyway yet), but I've done some googling and not come up
with much (if anything) regarding this.

I'm hoping to write a script that I can use to accept user input for x,y
coords for an image size. The image would initially be stored in SVG
format for quality and would like to then resize this according to the
users dimension specifications and produce a PNG image.

My server doesn't run X (for obvious reasons? =) ) and I don't _really_
want top have to bloat it out with gnomelibs and the likes to install
Sodipodi on it to do the conversions so was wondering if anyone knew of
anything available to help in the process.

I'm happy to work on the XML itself with PHP (althoguh I'd need to
research some on the topic).. but was kind of hoping someone knew of a
small binary that I could run via system() / exec() etc for simplicity.

Any info / suggestions / recommendations et al. greatly welcomed =)
TIA.

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

Jul 17 '05 #1
6 27225

On 2003-12-20, Ian.H <ia*@WINDOZEdigiserv.net> wrote:
Hi all,

I don't have ImageMagick installed currently (and not sure if this has the
ability or not anyway yet), but I've done some googling and not come up
with much (if anything) regarding this.
[..]
My server doesn't run X (for obvious reasons? =) ) and I don't _really_
want top have to bloat it out with gnomelibs and the likes to install
Sodipodi on it to do the conversions so was wondering if anyone knew of
anything available to help in the process.


You dont need X to run imagemagick's convert program.
Jul 17 '05 #2
"Martin Wickman" <wi*****@hotbrev.com> schreef in bericht
news:sl********************@babar.tuffmusik.nu...
You dont need X to run imagemagick's convert program.


Will I need access to my php configuration before I can use ImageMagick with
PHP? I don't have that access but I do need to convert my SVG files to PNG
(or some other raster format). Java isn't enabled in my PHP configuration
either. What now?

Remon.
Jul 17 '05 #3

On 2003-12-25, Remon Huijts <tr*****@hotmail.com> wrote:
"Martin Wickman" <wi*****@hotbrev.com> schreef in bericht
You dont need X to run imagemagick's convert program.


Will I need access to my php configuration before I can use
ImageMagick with PHP? I don't have that access but I do need to
convert my SVG files to PNG (or some other raster format). Java
isn't enabled in my PHP configuration either. What now?


Just call 'exec("/usr/bin/convert my.svg my.png")' and it will
work. Assuming that your IM installation can handle SVG that is.
Jul 17 '05 #4
"Martin Wickman" <wi*****@hotbrev.com> schreef in bericht
news:sl********************@babar.tuffmusik.nu...

On 2003-12-25, Remon Huijts <tr*****@hotmail.com> wrote:
"Martin Wickman" <wi*****@hotbrev.com> schreef in bericht
You dont need X to run imagemagick's convert program.


Will I need access to my php configuration before I can use
ImageMagick with PHP? I don't have that access but I do need to
convert my SVG files to PNG (or some other raster format). Java
isn't enabled in my PHP configuration either. What now?


Just call 'exec("/usr/bin/convert my.svg my.png")' and it will
work. Assuming that your IM installation can handle SVG that is.


Well I tested ImageMagick on my Windows machine a little, though I will be
needing it on a shared Linux server. My first SVG -> PNG convert did not
look very well, but I understand that there is still some work to do in the
ImageMagick support for SVG. Do you happen to know a list of things that are
not supported yet? For instance, looking at the PNG result, my first guess
is that defining styles in a <style> tag is not supported and the transform
attribute seems to be ignored as well.

Remon.
Jul 17 '05 #5
On 2003-12-26, Remon Huijts <tr*****@hotmail.com> wrote:
"Martin Wickman" <wi*****@hotbrev.com> schreef in bericht
news:sl********************@babar.tuffmusik.nu...

On 2003-12-25, Remon Huijts <tr*****@hotmail.com> wrote:
> "Martin Wickman" <wi*****@hotbrev.com> schreef in bericht
>> You dont need X to run imagemagick's convert program.
>
> Will I need access to my php configuration before I can use
> ImageMagick with PHP? I don't have that access but I do need to
> convert my SVG files to PNG (or some other raster format). Java
> isn't enabled in my PHP configuration either. What now?
Just call 'exec("/usr/bin/convert my.svg my.png")' and it will
work. Assuming that your IM installation can handle SVG that is.


Well I tested ImageMagick on my Windows machine a little, though I will be
needing it on a shared Linux server. My first SVG -> PNG convert did not
look very well, but I understand that there is still some work to do in the
ImageMagick support for SVG. Do you happen to know a list of things that are
not supported yet?


Nope, sorry. I just did att quick test with a small svg and it
worked.
For instance, looking at the PNG result, my first guess is that
defining styles in a <style> tag is not supported and the transform
attribute seems to be ignored as well.


I suggesst you read up on http://www.imagemagick.org/ and the mailing
lists for. Why not try to add the needed/broken <style>-support to IM
yourself?
Jul 17 '05 #6
"Martin Wickman" <wi*****@hotbrev.com> schreef in bericht
news:sl*******************@babar.tuffmusik.nu...
On 2003-12-25, Remon Huijts <tr*****@hotmail.com> wrote:

For instance, looking at the PNG result, my first guess is that
defining styles in a <style> tag is not supported and the transform
attribute seems to be ignored as well.


I suggesst you read up on http://www.imagemagick.org/ and the mailing
lists for. Why not try to add the needed/broken <style>-support to IM
yourself?


Can I do that without programming in C? Sadly I could not find any specific
information about SVG support on the ImageMagick site. There was little
discussion about it on the forums as well. On top of that I found out that
my hosting provider does not have ImageMagick installed on the server. So I
decided to step away from ImageMagick, and eat up the SVG with PHP, and spit
out some PNG using the PHP GD library. That kills a lot of the nice
anti-aliasing though...

Remon.
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Tonio | last post: by
7 posts views Thread by Dennis Benzinger | last post: by
61 posts views Thread by phil-news-nospam | last post: by
1 post views Thread by Ganesh Palaniappan | last post: by
2 posts views Thread by neilsanner | last post: by
1 post views Thread by Zhang Weiwu | last post: by
reply views Thread by vaskarbasak | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.