Some options of ImageMagick are not supported by RMagick. Also sometimes it is in fact more convenient to use ImageMagick. Is there a method (of the Image object) that allows you to send commands directly to ImageMagick using the command line interface?
Would it be ok for you to use system
or system call via backticks (or similar)?
You may also extend Magick::Image
to do it easier.
My example code add a method convert
to call the convert-command of imagemagick for the actual image. The action to be performed must be added.
require 'rmagick'
module Magick
class Image
def convert( cmd )
`convert #{self.filename} #{cmd}`
end
end
end
picname = Dir['*.jpg'].first
img = Magick::Image.read(picname).first
img.convert('x.png')
来源:https://stackoverflow.com/questions/9338185/ask-rmagick-to-send-a-direct-command-to-imagemagick