Class: IPTC::JPEG::Markers::APP0Marker
- Inherits:
-
IPTC::JPEG::Marker
- Object
- IPTC::JPEG::Marker
- IPTC::JPEG::Markers::APP0Marker
- Defined in:
- lib/iptc/jpeg/markers.rb
Overview
The APP0Marker
Contains some useful JFIF informations about the current image.
Instance Attribute Summary
Attributes inherited from IPTC::JPEG::Marker
Instance Method Summary collapse
- #[](item) ⇒ Object
-
#initialize(type, data) ⇒ APP0Marker
constructor
A new instance of APP0Marker.
- #parse ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from IPTC::JPEG::Marker
NewMarker, #l, #properties, #read, #to_binary
Constructor Details
#initialize(type, data) ⇒ APP0Marker
Returns a new instance of APP0Marker.
185 186 187 |
# File 'lib/iptc/jpeg/markers.rb', line 185 def initialize type, data super type, data end |
Instance Method Details
#[](item) ⇒ Object
205 206 207 |
# File 'lib/iptc/jpeg/markers.rb', line 205 def [](item) return @values[item] end |
#parse ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/iptc/jpeg/markers.rb', line 194 def parse @values = { 'APP0/revision'=>read(2).unpack('n')[0], 'APP0/unit' => read(1), 'APP0/xdensity' => read(2).unpack('n')[0], 'APP0/ydensity' => read(2).unpack('n')[0], 'APP0/xthumbnail' => read(1).unpack('c')[0], 'APP0/ythumbnail' => read(1).unpack('c')[0] } end |
#valid? ⇒ Boolean
188 189 190 191 192 193 |
# File 'lib/iptc/jpeg/markers.rb', line 188 def valid? if read(5)!="JFIF\0" return false end return true end |