Module: FormatParser::EXIFParser

Extended by:
EXIFParser
Included in:
ARWParser, CR2Parser, CR3Parser::Decoder, EXIFParser, JPEGParser, NEFParser, RW2Parser, TIFFParser, WebpParser
Defined in:
lib/parsers/exif_parser.rb

Defined Under Namespace

Classes: EXIFResult, EXIFStack, IOExt

Constant Summary collapse

ORIENTATIONS =
{
  0 => :unknown, # Non-rotated
  1 => :top_left, # Non-rotated
  2 => :top_right, # Non-rotated
  3 => :bottom_right, # Non-rotated
  4 => :bottom_left, # Non-rotated
  5 => :left_top,
  6 => :right_top,
  7 => :right_bottom,
  8 => :left_bottom
}

Instance Method Summary collapse

Instance Method Details

#exif_from_tiff_io(constrained_io, should_include_sub_ifds = false) ⇒ Object



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/parsers/exif_parser.rb', line 175

def exif_from_tiff_io(constrained_io, should_include_sub_ifds = false)
  Measurometer.instrument('format_parser.exif_parser.exif_from_tiff_io') do
    extended_io = IOExt.new(constrained_io)
    exif_raw_data = EXIFR::TIFF.new(extended_io, load_thumbnails: false)

    return unless exif_raw_data

    sub_ifds_data = {}
    if should_include_sub_ifds
      sub_ifds_offsets = exif_raw_data.flat_map(&:sub_ifds).compact
      sub_ifds_data = load_sub_ifds(extended_io, sub_ifds_offsets)
    end

    EXIFResult.new(exif_raw_data, sub_ifds_data)
  end
end