Class: FastImage::IsoBmff

Inherits:
Object
  • Object
show all
Defined in:
lib/fastimage.rb

Overview

HEIC/AVIF are a special case of the general ISO_BMFF format, in which all data is encapsulated in typed boxes, with a mandatory ftyp box that is used to indicate particular file types. Is composed of nested “boxes”. Each box has a header composed of

  • Size (32 bit integer)

  • Box type (4 chars)

  • Extended size: only if size === 1, the type field is followed by 64 bit integer of extended size

  • Payload: Type-dependent

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ IsoBmff

:nodoc:



599
600
601
# File 'lib/fastimage.rb', line 599

def initialize(stream)
  @stream = stream
end

Instance Method Details

#width_and_heightObject



603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
# File 'lib/fastimage.rb', line 603

def width_and_height
  @rotation = 0
  @max_size = nil
  @primary_box = nil
  @ipma_boxes = []
  @ispe_boxes = []
  @final_size = nil

  catch :finish do
    read_boxes!
  end

  if [90, 270].include?(@rotation)
    @final_size.reverse
  else
    @final_size
  end
end