3

I want to convert an SVG to a transparent PNG using the following MiniMagick command on a Carrierwave upload:

convert input.svg -transparent white output.png

How can I achieve that? Please provide FULL-EXAMPLE

Jeremy Lynch
  • 6,780
  • 3
  • 52
  • 63
  • This place isn't for tell me how to do x. You're supposed to have tried some stuff and need additional help. You tagged a few libraries that can do this. You just need to specify those settings on your uploader for carrierwave. – CWitty Dec 02 '19 at 02:13
  • Use https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-create-a-thumbnail-with-both-color-and-grayscale-versions-in-one-image as inspiration – CWitty Dec 02 '19 at 02:24
  • I didn't add an example to keep the question brief. Please see what I have already tried here: https://github.com/carrierwaveuploader/carrierwave/issues/2440 – Jeremy Lynch Dec 02 '19 at 13:27

1 Answers1

1

I have read that convert options have to be before the input file. Try with

MiniMagick::Tool::Convert.new do |convert|
  convert << "-density" << "72" 
  convert << "-transparent" << "white"
  convert << "input.svg"
  convert << "output.png"
end
Tun
  • 1,345
  • 13
  • 34