Module: Imogen

Extended by:
FFI::Library
Defined in:
lib/imogen.rb,
lib/imogen/dzi.rb,
lib/imogen/iiif.rb,
lib/imogen/zoomable.rb,
lib/imogen/auto_crop.rb,
lib/imogen/iiif/size.rb,
lib/imogen/iiif/tiles.rb,
lib/imogen/iiif/region.rb,
lib/imogen/iiif/rotation.rb

Defined Under Namespace

Modules: AutoCrop, Cropped, Dzi, Iiif, Scaled, Zoomable

Class Method Summary collapse

Class Method Details

.format_from(image_path) ⇒ Object



35
36
37
# File 'lib/imogen.rb', line 35

def self.format_from(image_path)
  raise "format from path not implemented"
end

.from(src_path) {|Vips::Image.matload(src_path)| ... } ⇒ Object

Yields:

  • (Vips::Image.matload(src_path))


15
16
17
# File 'lib/imogen.rb', line 15

def self.from(src_path)
  yield Vips::Image.matload(src_path)
end

.image(src_path, opts = {}) ⇒ Object

Parameters:

  • src_path (String)

    The local file path to the image.

  • opts (Hash) (defaults to: {})

    The options to use when opening an image.

Options Hash (opts):

  • :revalidate (Boolean) — default: Requires libvips > 8.15

    When true, will force the underlying Vips library to reload the source file instead of using cached data from an earlier read. This is useful if the source file was recently recreated.



45
46
47
48
49
50
51
# File 'lib/imogen.rb', line 45

def self.image(src_path, opts = {})
  if opts.empty?
    Vips::Image.new_from_file(src_path)
  else
    Vips::Image.new_from_file(src_path, **opts)
  end
end

.with_image(src_path, opts = {}, &block) ⇒ Object

Parameters:

  • src_path (String)

    The local file path to the image.

  • opts (Hash) (defaults to: {})

    The options to use when opening an image.

Options Hash (opts):

  • :revalidate (Boolean) — default: Requires libvips > 8.15

    When true, will force the underlying Vips library to reload the source file instead of using cached data from an earlier read. This is useful if the source file was recently recreated.



59
60
61
# File 'lib/imogen.rb', line 59

def self.with_image(src_path, opts = {}, &block)
  block.yield(image(src_path, opts))
end