Module: MiniMagick

Extended by:
Configuration
Defined in:
lib/mini_magick.rb,
lib/mini_magick/tool.rb,
lib/mini_magick/image.rb,
lib/mini_magick/shell.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/magick.rb,
lib/mini_magick/tool/stream.rb,
lib/mini_magick/tool/animate.rb,
lib/mini_magick/tool/compare.rb,
lib/mini_magick/tool/conjure.rb,
lib/mini_magick/tool/convert.rb,
lib/mini_magick/tool/display.rb,
lib/mini_magick/tool/mogrify.rb,
lib/mini_magick/tool/montage.rb,
lib/mini_magick/configuration.rb,
lib/mini_magick/tool/identify.rb,
lib/mini_magick/tool/composite.rb,
lib/mini_magick/tool/mogrify_restricted.rb

Defined Under Namespace

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

Constant Summary

Constants included from Configuration

Configuration::CLI_DETECTION

Instance Attribute Summary

Attributes included from Configuration

#cli_path, #cli_prefix, #debug, #logger, #processor_path, #shell_api, #timeout, #tmpdir, #validate_on_create, #validate_on_write, #whiny

Class Method Summary collapse

Methods included from Configuration

cli, cli=, configure, extended, processor, processor=, reload_tools

Class Method Details

.cli_versionString

Returns ImageMagick’s/GraphicsMagick’s version.

Returns:

  • (String)


53
54
55
56
# File 'lib/mini_magick.rb', line 53

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)


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

def self.graphicsmagick?
  cli == :graphicsmagick
end

.imagemagick7?Boolean

Checks whether the CLI used is ImageMagick 7.

Returns:

  • (Boolean)


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

def self.imagemagick7?
  cli == :imagemagick7
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