Class: ImageVoodoo::Metadata
- Inherits:
-
Object
- Object
- ImageVoodoo::Metadata
- Defined in:
- lib/image_voodoo/metadata.rb
Instance Method Summary collapse
-
#[](dirname) ⇒ Object
This will return a fairly useless Directory if you ask for one and there is no data in the image you are requesting.
-
#height ⇒ Object
FIXME: I wonder if this needs to fall back to try all other directories for Image Height.
-
#initialize(io) ⇒ Metadata
constructor
A new instance of Metadata.
-
#make ⇒ Object
Common metadata methods exposed as convenience functions so users do not need to dig around in the various directories.
- #model ⇒ Object
- #orientation ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(io) ⇒ Metadata
Returns a new instance of Metadata.
6 7 8 |
# File 'lib/image_voodoo/metadata.rb', line 6 def initialize(io) @metadata = com.drew.imaging.ImageMetadataReader. io end |
Instance Method Details
#[](dirname) ⇒ Object
This will return a fairly useless Directory if you ask for one and there is no data in the image you are requesting. The reason for doing this is so queries like ‘md[:Orientation]’ can run and just return nil since I think this is the common case.
See Directory#exists? if you want to make sure the group you are requesting actually exists or not.
19 20 21 22 23 |
# File 'lib/image_voodoo/metadata.rb', line 19 def [](dirname) dirclass = DIRECTORY_MAP[dirname.to_s] raise ArgumentError.new "Uknown metadata group: #{dirname}" unless dirclass dirclass.new @metadata end |
#height ⇒ Object
FIXME: I wonder if this needs to fall back to try all other directories for Image Height
41 42 43 |
# File 'lib/image_voodoo/metadata.rb', line 41 def height self['Exif Sub IFD']['Exif Image Height'] end |
#make ⇒ Object
Common metadata methods exposed as convenience functions so users do not need to dig around in the various directories
27 28 29 |
# File 'lib/image_voodoo/metadata.rb', line 27 def make self[:IFD0][:Make] end |
#model ⇒ Object
31 32 33 |
# File 'lib/image_voodoo/metadata.rb', line 31 def model self[:IFD0][:Model] end |
#orientation ⇒ Object
35 36 37 |
# File 'lib/image_voodoo/metadata.rb', line 35 def orientation self[:IFD0][:Orientation] end |
#width ⇒ Object
45 46 47 |
# File 'lib/image_voodoo/metadata.rb', line 45 def width self['Exif Sub IFD']['Exif Image Width'] end |