maxim / skeptick

Better ImageMagick for Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unrecognized option `-background transparent'

RobWu opened this issue · comments

Try to run a converter from svg to png.

    command = convert(to: "#{file_name}.png") do
      set '-background transparent'
      image "#{file_name}.svg"
    end
    command.run

But get always error (no difference when i change order of 'image ...' and set '...')

convert: unrecognized option `-background transparent' @ error/convert.c/ConvertImageCommand/853.

When i run the output in the console or with method 'system' (f.e system command.to_s) it works fine.

@RobWu Everything you pass to set is shell-escaped, including spaces, meaning that it's treated like a single word. You gotta separate your arguments to indicate that it's multiple words. Either of the following will work:

# these 2 are equivalent
set :background, 'transparent'
set '-background', 'transparent'

@RobWu I noticed I still had a couple of outdated examples in the README, so I cleaned it up + added clarification about your case. https://github.com/maxim/skeptick#set

Cool, thanks