Class: Phantom::SVG::Parser::GIFReader

Inherits:
AbstractImageReader show all
Includes:
Magick
Defined in:
lib/phantom/parser/gif_reader.rb

Overview

GIF 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 gif file from path.



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

def read(path, _options = {})
  reset

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

  frames = create_frames(path)
  @frames += frames
  @width = "#{frames.first.width}"
  @height = "#{frames.first.height}"
  @loops = 0
  @skip_first = frames[0].duration == 0.0
  @has_animation = true
end