module ImageProcessing::MiniMagick

def self.convert_shim(&block)

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

def self.valid_image?(file)

Returns whether the given image file is processable.
def self.valid_image?(file)
  convert_shim do |convert|
    convert << file.path
    convert << "null:"
  end
  true
rescue ::MiniMagick::Error
  false
end