module MojoMagickDeprecations
Two command-line builders, convert and mogrify, have been added to simplify complex commands. Examples included below.
Example convert usage:
MojoMagick::convert('source.jpg', 'dest.jpg') do |c| c.crop '250x250+0+0' c.repage! c.strip c.set 'comment', 'my favorite file' end
Equivalent to:
MojoMagick::Commands.raw_command('convert', 'source.jpg -crop 250x250+0+0\ +repage -strip -set comment "my favorite file" dest.jpg')
Example mogrify usage:
MojoMagick::mogrify('image.jpg') {|i| i.shave '10x10'}
Equivalent to:
MojoMagick::Commands.raw_command('mogrify', '-shave 10x10 image.jpg')
Example showing some additional options:
MojoMagick::convert do |c| c.file 'source.jpg' c.blob my_binary_data c.append c.crop '256x256+0+0' c.repage! c.file 'output.jpg' end
Use .file to specify file names, .blob to create and include a tempfile. The bang (!) can be appended to command names to use the ‘+’ versions instead of ‘-’ versions.
Public Instance Methods
execute(*args)
click to toggle source
# File lib/mojo_magick.rb, line 78 def execute(*args) warn "DEPRECATION WARNING: #{__method__} is deprecated and will be removed with the next minor version release. " \ "Please use `MojoMagick::Commands.execute!` instead" MojoMagick::Commands.send(:execute, *args) end
execute!(*args)
click to toggle source
rubocop:enable Naming/AccessorMethodName
Moved to `Commands`
# File lib/mojo_magick.rb, line 72 def execute!(*args) warn "DEPRECATION WARNING: #{__method__} is deprecated and will be removed with the next minor version release. " \ "Please use `MojoMagick::Commands.execute!` instead" MojoMagick::Commands.send(:execute!, *args) end
get_fonts()
click to toggle source
rubocop:disable Naming/AccessorMethodName
# File lib/mojo_magick.rb, line 64 def get_fonts warn "DEPRECATION WARNING: #{__method__} is deprecated and will be removed with the next minor version release. " \ "Please use `available_fonts` instead" MojoMagick.available_fonts end
raw_command(*args)
click to toggle source
# File lib/mojo_magick.rb, line 84 def raw_command(*args) warn "DEPRECATION WARNING: #{__method__} is deprecated and will be removed with the next minor version release. " \ "Please use `MojoMagick::Commands.execute!` instead" MojoMagick::Commands.raw_command(*args) end