Module: MiniMagick

Extended by:
Configuration
Defined in:
lib/mini_magick.rb,
lib/mini_magick/tool.rb,
lib/mini_magick/shell.rb,
lib/mini_magick/image.rb,
lib/mini_magick/logger.rb,
lib/mini_magick/version.rb,
lib/mini_magick/utilities.rb,
lib/mini_magick/image/info.rb,
lib/mini_magick/tool/import.rb,
lib/mini_magick/tool/stream.rb,
lib/mini_magick/tool/display.rb,
lib/mini_magick/tool/animate.rb,
lib/mini_magick/tool/compare.rb,
lib/mini_magick/tool/montage.rb,
lib/mini_magick/tool/mogrify.rb,
lib/mini_magick/tool/conjure.rb,
lib/mini_magick/tool/convert.rb,
lib/mini_magick/configuration.rb,
lib/mini_magick/tool/identify.rb,
lib/mini_magick/tool/composite.rb

Defined Under Namespace

Modules: Configuration, VERSION Classes: Error, Image, Invalid, Tool

Instance Attribute Summary

Attributes included from Configuration

#cli, #cli_path, #debug, #logger, #shell_api, #timeout, #validate_on_create, #validate_on_write, #whiny

Class Method Summary collapse

Methods included from Configuration

configure, reload_tools

Class Method Details

.cli_versionString

Returns ImageMagick's/GraphicsMagick's version.

Returns:

  • (String)


45
46
47
48
# File 'lib/mini_magick.rb', line 45

def self.cli_version
  output = MiniMagick::Tool::Identify.new(&:version)
  output[/\d+\.\d+\.\d+(-\d+)?/]
end

.graphicsmagick?Boolean

Checks whether the CLI used is GraphicsMagick.

Returns:

  • (Boolean)


37
38
39
# File 'lib/mini_magick.rb', line 37

def self.graphicsmagick?
  cli == :graphicsmagick
end

.imagemagick?Boolean

Checks whether the CLI used is ImageMagick.

Returns:

  • (Boolean)


29
30
31
# File 'lib/mini_magick.rb', line 29

def self.imagemagick?
  cli == :imagemagick
end

.versionGem::Version

Returns:

  • (Gem::Version)


5
6
7
# File 'lib/mini_magick/version.rb', line 5

def self.version
  Gem::Version.new VERSION::STRING
end

.with_cli(cli) ⇒ Object

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.

Examples:

MiniMagick.with_cli :graphicsmagick do
  # operations that are better done with GraphicsMagick
end


17
18
19
20
21
22
23
# 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