Class: FastImageParsing::Png

Inherits:
ImageBase show all
Defined in:
lib/fastimage/fastimage_parsing/png.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)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fastimage/fastimage_parsing/png.rb', line 7

def animated?
  # Signature (8) + IHDR chunk (4 + 4 + 13 + 4)
  @stream.read(33)

  loop do
    length = @stream.read(4).unpack("L>")[0]
    type = @stream.read(4)

    case type
    when "acTL"
      return true
    when "IDAT"
      return false
    end

    @stream.skip(length + 4)
  end
end

#dimensionsObject



3
4
5
# File 'lib/fastimage/fastimage_parsing/png.rb', line 3

def dimensions
  @stream.read(25)[16..24].unpack('NN')
end