4

Here's a link to my test: http://pestnow.herokuapp.com/tester/svg The image on the left is SVG, the one on the right is the PNG conversion. Here's the extremely simple code for the conversion:

def self.svg_to_png(svg)
  img = Magick::Image::from_blob(svg)
  return img[0].to_blob {self.format = 'PNG'}
end

I've been struggling with this problem and had this answered question here: SVG to PNG Conversion with ImageMagick doesn't handle defs? That question had to do with getting IM to do the conversion properly. And it DOES, from the command line with a simple "convert test.svg test.png"

But the RMagick conversion doesn't work the same. On my local dev box, I do have ImageMagick compiled with RVG support, and that fixed the command line. But I have no clue how to make RMagick use it the same way.

Furthermore, I'm hoping its something I need to do in my code, and not some feature required on the server, because this app is hosted on heroku and I have no control over how they install IM.

Community
  • 1
  • 1
Dave Sanders
  • 3,135
  • 4
  • 33
  • 43
  • 3
    I'm come to the conclusion that Heroku doesn't have RSVG support in their copy of ImageMagick and have contacted them to see if they can enable it. I'll report back with the conclusion from my support ticket. – Dave Sanders May 21 '12 at 16:45
  • Yeah heroku has ImageMagick installed already, but from what I've read you can't really customize your setup on there. You could try a different host that lets you install stuff... – AJcodez Jul 26 '12 at 18:24
  • 1
    the link is dead http://pestnow.herokuapp.com/tester/svg 404 – Besi Jul 15 '14 at 08:33

1 Answers1

0

I should have reported back.

Yes, Heroku has IM, but they don't support it. It's just there as part of the long term support version of (I believe) Ubuntu that they use. We talked back and forth a few times, and they have said that they might upgrade it in the future, along with other linux libs / utils, but that there was no definite timeframe. My guess is, maybe on the next stack.

Until then, I've stopped using symbols in my SVG and had to do a few tricks on order of transforms, but for the most part I have things working. Another piece of advice is to make sure you are using the EXACT version of IM that Heroku uses on your Dev box. Saves a lot of heartache.

Dave Sanders
  • 3,135
  • 4
  • 33
  • 43
  • it's been a while. May I ask which IM version are you running on Heroku? I am having the same problems with SVG support. – Nobita Aug 14 '14 at 20:30
  • Here's what Heroku says right now on that server - I have no idea if its changed since I first posted this. Version: ImageMagick 6.5.7-8 2012-08-17 Q16 http://www.imagemagick.org Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC Features: OpenMP – Dave Sanders Aug 15 '14 at 12:57