Class: FastImageParsing::IsoBmff
- Inherits:
-
Object
- Object
- FastImageParsing::IsoBmff
- Defined in:
- lib/fastimage/fastimage_parsing/iso_bmff.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 Attribute Summary collapse
-
#height ⇒ Object
readonly
:nodoc:.
-
#width ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#initialize(stream) ⇒ IsoBmff
constructor
A new instance of IsoBmff.
- #parse_isobmff ⇒ Object
Constructor Details
#initialize(stream) ⇒ IsoBmff
Returns a new instance of IsoBmff.
12 13 14 15 16 |
# File 'lib/fastimage/fastimage_parsing/iso_bmff.rb', line 12 def initialize(stream) @stream = stream @width, @height = nil parse_isobmff end |
Instance Attribute Details
#height ⇒ Object (readonly)
:nodoc:
10 11 12 |
# File 'lib/fastimage/fastimage_parsing/iso_bmff.rb', line 10 def height @height end |
#width ⇒ Object (readonly)
:nodoc:
10 11 12 |
# File 'lib/fastimage/fastimage_parsing/iso_bmff.rb', line 10 def width @width end |
Instance Method Details
#parse_isobmff ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fastimage/fastimage_parsing/iso_bmff.rb', line 18 def parse_isobmff @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! end @width, @height = @final_size end |