Module: ImageProcessing::Vips

Extended by:
Chainable
Defined in:
lib/image_processing/vips.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

.valid_image?(file) ⇒ Boolean

Returns whether the given image file is processable.

Returns:

  • (Boolean)


11
12
13
14
15
16
# File 'lib/image_processing/vips.rb', line 11

def self.valid_image?(file)
  ::Vips::Image.new_from_file(file.path, access: :sequential).avg
  true
rescue ::Vips::Error
  false
end