Module: ImageProcessing::MiniMagick

Extended by:
Chainable
Defined in:
lib/image_processing/mini_magick.rb

Defined Under Namespace

Classes: Processor

Class Method Summary collapse

Methods included from Chainable

apply, branch, call, convert, instrumenter, loader, operation, saver, source

Class Method Details

.convert_shim(&block) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/image_processing/mini_magick.rb', line 8

def self.convert_shim(&block)
  if ::MiniMagick.respond_to?(:convert)
    ::MiniMagick.convert(&block)
  else
    ::MiniMagick::Tool::Convert.new(&block)
  end
end

.valid_image?(file) ⇒ Boolean

Returns whether the given image file is processable.

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
# File 'lib/image_processing/mini_magick.rb', line 17

def self.valid_image?(file)
  convert_shim do |convert|
    convert << file.path
    convert << "null:"
  end
  true
rescue ::MiniMagick::Error
  false
end