Class: Phantom::SVG::Parser::PNGReader

Inherits:
AbstractImageReader show all
Defined in:
lib/phantom/parser/png_reader.rb

Overview

PNG reader.

Instance Attribute Summary

Attributes inherited from AbstractImageReader

#frames, #has_animation, #height, #loops, #skip_first, #width

Instance Method Summary collapse

Methods inherited from AbstractImageReader

#initialize

Constructor Details

This class inherits a constructor from Phantom::SVG::Parser::AbstractImageReader

Instance Method Details

#read(path, _options = {}) ⇒ Object

Read png file from path.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/phantom/parser/png_reader.rb', line 15

def read(path, _options = {})
  reset

  return if path.nil? || path.empty?

  apngasm = APNG::APNGAsm.new
  apngasm.disassemble(path)

  if apngasm.frame_count == 1
    read_png(path)
  else
    read_apng(apngasm)
  end
end