Class: Halation::ExifToolImage

Inherits:
Object
  • Object
show all
Defined in:
lib/halation/tools/exif_tool/image.rb

Overview

Image interface implementation for ExifTool. Available as apt package ‘libimage-exiftool-perl`.

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ ExifToolImage

Returns a new instance of ExifToolImage.

Parameters:

  • file_path (String)

    Path to the image file.



10
11
12
# File 'lib/halation/tools/exif_tool/image.rb', line 10

def initialize(file_path)
  @image = MiniExiftool.new(file_path, numerical: true)
end

Instance Method Details

#[](tag) ⇒ Object

Read an Exif tag.

Parameters:

  • tag (String, Symbol)


16
17
18
# File 'lib/halation/tools/exif_tool/image.rb', line 16

def [](tag)
  @image[tag]
end

#[]=(tag, value) ⇒ Object

Write an Exif tag.

Parameters:

  • tag (String, Symbol)
  • value (String)


23
24
25
# File 'lib/halation/tools/exif_tool/image.rb', line 23

def []=(tag, value)
  @image[tag] = value
end

#saveObject

Save the Exif data to the image file.



28
29
30
# File 'lib/halation/tools/exif_tool/image.rb', line 28

def save
  @image.save
end