Class: Dimensions::TiffScanner
- Includes:
- TiffScanning
- Defined in:
- lib/dimensions/tiff_scanner.rb
Constant Summary collapse
- WIDTH_TAG =
0x100- HEIGHT_TAG =
0x101
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Attributes inherited from Scanner
Instance Method Summary collapse
-
#initialize(data) ⇒ TiffScanner
constructor
A new instance of TiffScanner.
- #scan ⇒ Object
Methods included from TiffScanning
#read_integer_value, #scan_and_skip_to_offset, #scan_endianness, #scan_header, #scan_ifd, #scan_tag_mark
Methods inherited from Scanner
#advance, #big!, #little!, #raise_scan_error, #read, #read_char, #read_data, #read_long, #read_short, #skip_to
Constructor Details
#initialize(data) ⇒ TiffScanner
Returns a new instance of TiffScanner.
13 14 15 16 17 |
# File 'lib/dimensions/tiff_scanner.rb', line 13 def initialize(data) @width = nil @height = nil super end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
11 12 13 |
# File 'lib/dimensions/tiff_scanner.rb', line 11 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
11 12 13 |
# File 'lib/dimensions/tiff_scanner.rb', line 11 def width @width end |
Instance Method Details
#scan ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dimensions/tiff_scanner.rb', line 19 def scan scan_header scan_ifd do |tag| if tag == WIDTH_TAG @width = read_integer_value elsif tag == HEIGHT_TAG @height = read_integer_value end end @width && @height end |