module MiniMagick

Public Class Methods

cli_version() click to toggle source

Returns ImageMagick's/GraphicsMagick's version.

@return [String]

# File lib/mini_magick.rb, line 45
def self.cli_version
  output = MiniMagick::Tool::Identify.new(&:version)
  output[/\d+\.\d+\.\d+(-\d+)?/]
end
graphicsmagick?() click to toggle source

Checks whether the CLI used is GraphicsMagick.

@return [Boolean]

# File lib/mini_magick.rb, line 37
def self.graphicsmagick?
  cli == :graphicsmagick
end
imagemagick?() click to toggle source

Checks whether the CLI used is ImageMagick.

@return [Boolean]

# File lib/mini_magick.rb, line 29
def self.imagemagick?
  cli == :imagemagick
end
version() click to toggle source

@return [Gem::Version]

# File lib/mini_magick/version.rb, line 5
def self.version
  Gem::Version.new VERSION::STRING
end
with_cli(cli) { || ... } click to toggle source

You might want to execute only certain blocks of processing with a different CLI, because for example that CLI does that particular thing faster. After the block CLI resets to its previous value.

@example

MiniMagick.with_cli :graphicsmagick do
  # operations that are better done with GraphicsMagick
end
# File lib/mini_magick.rb, line 17
def self.with_cli(cli)
  old_cli = self.cli
  self.cli = cli
  yield
ensure
  self.cli = old_cli
end