SVG image conversion in Ruby on Rails

Asked

Viewed 49 times

1

I have an application in Rails and there I generate SVG images to return to the user by email, but I want to return this in another format (png or jpg). Does anyone have any tips on how I can do this?

  • I didn’t understand the question, you generate svg and want to convert to another format? That’s it?

  • That’s right Alex !

1 answer

0


Use the Gem mini_magick https://github.com/minimagick/minimagick

If you use Ubuntu, you need to have imagemagick and librsvg2-bin installed

image = MiniMagick::Image.open("input.svg")
image.format "png"
image.write "output.png"
  • Thanks Alex , I’ll try here !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.