Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'open-uri'
- require 'rsvg2'
- SRC = 'NewTux.svg'
- DST = 'tiger.png'
- unless File.exist?(SRC)
- open('http://upload.wikimedia.org/wikipedia/commons/b/b0/NewTux.svg') {|i|
- File.open(SRC, 'w') {|w|
- w.print i.read
- }
- }
- end
- svg = RSVG::Handle.new_from_file(SRC)
- surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32,
- 800, 800)
- context = Cairo::Context.new(surface)
- context.render_rsvg_handle(svg)
- surface.write_to_png(DST)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement