Converting SVG files to images

D

Daniel Berger

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
 
V

Vincent Fourmond

Daniel said:
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
 
F

Farrel Lifson

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

Vince

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

Farrel
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"Converting SVG files to images" on Wed, 15 Nov 2006 23:33:34 +0900,
Daniel Berger said:
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.

http://ruby-gnome2.cvs.sourceforge....rsvg/sample/svg2.rb?revision=HEAD&view=markup

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,
 
D

Daniel Berger

Kouhei said:
Hi,

In <[email protected]>
"Converting SVG files to images" on Wed, 15 Nov 2006 23:33:34 +0900,


http://ruby-gnome2.cvs.sourceforge....rsvg/sample/svg2.rb?revision=HEAD&view=markup

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. :)

Regards,

Dan
 
P

Patrick Hurley

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. :)

Regards,

Dan

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
 
D

Daniel Berger

Patrick Hurley 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
 
P

Patrick Hurley

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top