Method: Vips::Image#get

Defined in:
lib/vips/image.rb

#get(name) ⇒ Object

Get a metadata item from an image. Ruby types are constructed automatically from the GValue, if possible.

For example, you can read the ICC profile from an image like this:

profile = image.get "icc-profile-data"

and profile will be an array containing the profile.

Parameters:

  • name (String)

    Metadata field to get

Returns:

Raises:



767
768
769
770
771
772
773
774
775
776
777
778
779
780
# File 'lib/vips/image.rb', line 767

def get name
  # with old libvips, we must fetch properties (as opposed to
  # metadata) via VipsObject
  unless Vips.at_least_libvips?(8, 5)
    return super if parent_get_typeof(name) != 0
  end

  gvalue = GObject::GValue.alloc
  raise Vips::Error if Vips.vips_image_get(self, name, gvalue) != 0
  result = gvalue.get
  gvalue.unset

  result
end