Sha256: a1bc0abde6ce5a100368e8257bd1c549334725a91091d1349c53d254fa99387c

Contents?: true

Size: 500 Bytes

Versions: 1

Compression:

Stored size: 500 Bytes

Contents

module FastImageParsing
  class Png < ImageBase # :nodoc:
    def dimensions
      @stream.read(25)[16..24].unpack('NN')
    end
    
    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fastimage-2.4.0 lib/fastimage/fastimage_parsing/png.rb