Sha256: 70505a7bf43226bd326802149876d8f51125e1d0e2097ba48eeecc318bebb283

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

require 'mini_exiftool'

module Halation
  # Image interface implementation for ExifTool.
  # Available as apt package `libimage-exiftool-perl`.
  # @see http://www.sno.phy.queensu.ca/~phil/exiftool/
  class ExifToolImage

    # @param file_path [String] Path to the image file.
    def initialize(file_path)
      @image = MiniExiftool.new(file_path, numerical: true)
    end

    # Read an Exif tag.
    # @param tag [String, Symbol]
    def [](tag)
      @image[tag]
    end

    # Write an Exif tag.
    # @param tag [String, Symbol]
    # @param value [String]
    def []=(tag, value)
      @image[tag] = value
    end

    # Save the Exif data to the image file.
    def save
      @image.save
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
halation-0.3.0 lib/halation/tools/exif_tool/image.rb
halation-0.2.1 lib/halation/tools/exif_tool/image.rb
halation-0.2.0 lib/halation/tools/exif_tool/image.rb