Class: FastImageParsing::Webp

Inherits:
ImageBase show all
Defined in:
lib/fastimage/fastimage_parsing/webp.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from ImageBase

#initialize

Constructor Details

This class inherits a constructor from FastImageParsing::ImageBase

Instance Method Details

#animated?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fastimage/fastimage_parsing/webp.rb', line 18

def animated?
  vp8 = @stream.read(16)[12..15]
  _len = @stream.read(4).unpack("V")
  case vp8
  when "VP8 "
    false
  when "VP8L"
    false
  when "VP8X"
    flags = @stream.read(4).unpack("C")[0]
    flags & 2 > 0
  else
    nil
  end
end

#dimensionsObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fastimage/fastimage_parsing/webp.rb', line 3

def dimensions
  vp8 = @stream.read(16)[12..15]
  _len = @stream.read(4).unpack("V")
  case vp8
  when "VP8 "
    parse_size_vp8
  when "VP8L"
    parse_size_vp8l
  when "VP8X"
    parse_size_vp8x
  else
    nil
  end
end