Method: MiniExiftool#initialize

Defined in:
lib/mini_exiftool.rb

#initialize(filename_or_io = nil, opts = {}) ⇒ MiniExiftool

filename_or_io The kind of the parameter is determined via duck typing: if the argument responds to to_str it is interpreted as filename, if it responds to read it is interpreted es IO instance.

ATTENTION: If using an IO instance writing of meta data is not supported!

opts support at the moment

  • :numerical for numerical values, default is false

  • :composite for including composite tags while loading, default is true

  • :ignore_minor_errors ignore minor errors (See -m-option of the exiftool command-line application, default is false)

  • :coord_format set format for GPS coordinates (See -c-option of the exiftool command-line application, default is nil that means exiftool standard)

  • :fast useful when reading JPEGs over a slow network connection (See -fast-option of the exiftool command-line application, default is false)

  • :fast2 useful when reading JPEGs over a slow network connection (See -fast2-option of the exiftool command-line application, default is false)

  • :replace_invalid_chars replace string for invalid UTF-8 characters or false if no replacing should be done, default is false

  • :timestamps generating DateTime objects instead of Time objects if set to DateTime, default is Time

    ATTENTION: Time objects are created using Time.local therefore they use your local timezone, DateTime objects instead are created without timezone!

  • :exif_encoding, :iptc_encoding, :xmp_encoding, :png_encoding, :id3_encoding, :pdf_encoding, :photoshop_encoding, :quicktime_encoding, :aiff_encoding, :mie_encoding, :vorbis_encoding to set this specific encoding (see -charset option of the exiftool command-line application, default is nil: no encoding specified)



107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/mini_exiftool.rb', line 107

def initialize filename_or_io=nil, opts={}
  @opts = @@opts.merge opts
  if @opts[:convert_encoding]
    warn 'Option :convert_encoding is not longer supported!'
    warn 'Please use the String#encod* methods.'
  end
  @filename = nil
  @io = nil
  @values = TagHash.new
  @changed_values = TagHash.new
  @errors = TagHash.new
  load filename_or_io unless filename_or_io.nil?
end