SVG->PNG image conversion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ian.H

    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.ne t | forum.digiserv. net
    Programming, Web design, development & hosting.

  • Martin Wickman

    #2
    Re: SVG->PNG image conversion


    On 2003-12-20, Ian.H <ian@WINDOZEdig iserv.net> wrote:[color=blue]
    > 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.[/color]

    [..]
    [color=blue]
    > 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.[/color]

    You dont need X to run imagemagick's convert program.

    Comment

    • Remon Huijts

      #3
      Re: SVG-&gt;PNG image conversion

      "Martin Wickman" <wizball@hotbre v.com> schreef in bericht
      news:slrnbubfum .ap9.wizball@ba bar.tuffmusik.n u...[color=blue]
      > You dont need X to run imagemagick's convert program.[/color]

      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.


      Comment

      • Martin Wickman

        #4
        Re: SVG-&gt;PNG image conversion


        On 2003-12-25, Remon Huijts <trsteno@hotmai l.com> wrote:[color=blue]
        > "Martin Wickman" <wizball@hotbre v.com> schreef in bericht[color=green]
        >> You dont need X to run imagemagick's convert program.[/color]
        >
        > 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?[/color]

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

        Comment

        • Remon Huijts

          #5
          Re: SVG-&gt;PNG image conversion

          "Martin Wickman" <wizball@hotbre v.com> schreef in bericht
          news:slrnbup385 .e02.wizball@ba bar.tuffmusik.n u...[color=blue]
          >
          > On 2003-12-25, Remon Huijts <trsteno@hotmai l.com> wrote:[color=green]
          > > "Martin Wickman" <wizball@hotbre v.com> schreef in bericht[color=darkred]
          > >> You dont need X to run imagemagick's convert program.[/color]
          > >
          > > 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?[/color]
          >
          > Just call 'exec("/usr/bin/convert my.svg my.png")' and it will
          > work. Assuming that your IM installation can handle SVG that is.[/color]

          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.


          Comment

          • Martin Wickman

            #6
            Re: SVG-&gt;PNG image conversion

            On 2003-12-26, Remon Huijts <trsteno@hotmai l.com> wrote:[color=blue]
            > "Martin Wickman" <wizball@hotbre v.com> schreef in bericht
            > news:slrnbup385 .e02.wizball@ba bar.tuffmusik.n u...[color=green]
            >>
            >> On 2003-12-25, Remon Huijts <trsteno@hotmai l.com> wrote:[color=darkred]
            >> > "Martin Wickman" <wizball@hotbre v.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?[/color]
            >>
            >> Just call 'exec("/usr/bin/convert my.svg my.png")' and it will
            >> work. Assuming that your IM installation can handle SVG that is.[/color]
            >
            > 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?[/color]

            Nope, sorry. I just did att quick test with a small svg and it
            worked.
            [color=blue]
            > 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.[/color]

            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?

            Comment

            • Remon Huijts

              #7
              Re: SVG-&gt;PNG image conversion

              "Martin Wickman" <wizball@hotbre v.com> schreef in bericht
              news:slrnbuqpji .ok.wizball@bab ar.tuffmusik.nu ...[color=blue][color=green][color=darkred]
              > >> On 2003-12-25, Remon Huijts <trsteno@hotmai l.com> wrote:[/color]
              > > 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.[/color]
              >
              > 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?[/color]

              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.


              Comment

              Working...