Class: Cul::Image::Properties::Gif
- Defined in:
- lib/cul_image_props/image/properties/types.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(srcfile = nil) ⇒ Gif
constructor
A new instance of Gif.
Methods inherited from Base
#[], #add_dt_prop, #extent=, #format=, #hex_inspect, #inspect, #length=, #ord_value, #sampling_unit=, #width=, #x_sampling_freq=, #y_sampling_freq=
Constructor Details
#initialize(srcfile = nil) ⇒ Gif
Returns a new instance of Gif.
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/cul_image_props/image/properties/types.rb', line 131 def initialize(srcfile=nil) super header_bytes = @src.read(13) unless header_bytes[0...4].unpack('C*') == Cul::Image::Magic::GIF raise "Source file is not a gif: #{hex_inspect(header_bytes[0...4])}" end self.width= header_bytes[6,2].unpack('v')[0] self.length= header_bytes[8,2].unpack('v')[0] self.extent= srcfile.stat.size unless srcfile.nil? self.format= MIME[:gif] end |