Converting SVG files to images

Hi all,

I was just playing with the Ruby svg-graph library, and it seems to work
well.

I was wondering what tools people use to convert svg files into images?
Or is there a way to convert the generated file into an image using
svg-graph itself? Let’s assume my users don’t have a plugin to view svg
files directly in a web browser.

The main platform is Linux, but Solaris and Windows would be nice, too.

Thanks,

Dan

Daniel B. wrote:

Hi all,

I was just playing with the Ruby svg-graph library, and it seems to work
well.

I was wondering what tools people use to convert svg files into images?
Or is there a way to convert the generated file into an image using
svg-graph itself? Let’s assume my users don’t have a plugin to view svg
files directly in a web browser.

You can try convert, from ImageMagick. Basically convert anything to
nearly anything…

Vince

Hi,

In [email protected]
“Converting SVG files to images” on Wed, 15 Nov 2006 23:33:34 +0900,
Daniel B. [email protected] wrote:

I was just playing with the Ruby svg-graph library, and it seems to work
well.

I was wondering what tools people use to convert svg files into images?
Or is there a way to convert the generated file into an image using
svg-graph itself? Let’s assume my users don’t have a plugin to view svg
files directly in a web browser.

CVS Info for project ruby-gnome2

You can generate many file types (PNG, JPEG, GIF and so on)
if you have Ruby/RSVG and Ruby/GdkPixbuf2.

You can also generate PS, PDF, SVG and display your GTK+
widget if you also have rcairo.

Thanks,

On 15/11/06, Vincent F. [email protected] wrote:

You can try convert, from ImageMagick. Basically convert anything to
nearly anything…

    Vince


Vincent F., PhD student
http://vincent.fourmond.neuf.fr/

And then you can install RMagick and control it from Ruby.

Farrel

Farrel L. wrote:

files directly in a web browser.

Farrel

Thank you Farrel and Vince - I’ll take a look.

  • Dan

Kouhei S. wrote:

Or is there a way to convert the generated file into an image using
svg-graph itself? Let’s assume my users don’t have a plugin to view svg
files directly in a web browser.

CVS Info for project ruby-gnome2

You can generate many file types (PNG, JPEG, GIF and so on)
if you have Ruby/RSVG and Ruby/GdkPixbuf2.

You can also generate PS, PDF, SVG and display your GTK+
widget if you also have rcairo.

Thanks Kou, looks interesting. I couldn’t get cairo to build on my
Solaris box, though - I think the configure script is borked. But, as
long as I can convert to png or jpg, all is well. :slight_smile:

Regards,

Dan

On 11/15/06, Daniel B. [email protected] wrote:

You can also generate PS, PDF, SVG and display your GTK+

I have a hunch that Kou’s solution will work much better. In the
semi-recent past I tried using ImageMagick for SVG conversion and got
very poor results. I actually ended up using inkscape as a
rendering/conversion tool, which worked for my needs.

pth

Patrick H. wrote:

I have a hunch that Kou’s solution will work much better. In the
semi-recent past I tried using ImageMagick for SVG conversion and got
very poor results. I actually ended up using inkscape as a
rendering/conversion tool, which worked for my needs.

pth

Indeed. I’ve discovered that running ‘convert’ over the .svg file
gives me a black and white image. I’m not sure why and I haven’t a
clue what options I should be passing that might fix this, if any. I
may have to give Inkscape a try.

If you (or anyone else out there) has code samples of converting .svg
files to .png files using Kou’s solution, I’d like to see them.

Thanks,

Dan

On 11/15/06, Daniel B. [email protected] wrote:

Indeed. I’ve discovered that running ‘convert’ over the .svg file
gives me a black and white image. I’m not sure why and I haven’t a
clue what options I should be passing that might fix this, if any. I
may have to give Inkscape a try.

I just shelled out to inkscape and used command line parameters to
save the output to a png. It was fast and did a nice job.

If you (or anyone else out there) has code samples of converting .svg
files to .png files using Kou’s solution, I’d like to see them.

I have not tried Kou’s suggestion, but was guessing almost anything
would work better than “convert” and also that there was a reasonable
change that gtk shared the svg parse/render with inkscape (but I have
not verified this in any way).

pth