Class: EXIFR::TIFF::Orientation

Inherits:
Object
  • Object
show all
Defined in:
lib/exifr/tiff.rb

Overview

The orientation of the image with respect to the rows and columns.

Instance Method Summary (collapse)

Constructor Details

- (Orientation) initialize(value, type)

:nodoc:



253
254
255
# File 'lib/exifr/tiff.rb', line 253

def initialize(value, type) # :nodoc:
  @value, @type = value, type
end

Instance Method Details

- (Object) ==(other)

:nodoc:



282
283
284
# File 'lib/exifr/tiff.rb', line 282

def ==(other) # :nodoc:
  Orientation === other && to_i == other.to_i
end

- (Object) inspect

Debugging output.



263
264
265
# File 'lib/exifr/tiff.rb', line 263

def inspect
  "\#<EXIFR::TIFF::Orientation:#{@type}(#{@value})>"
end

- (Object) to_i

Field value.



258
259
260
# File 'lib/exifr/tiff.rb', line 258

def to_i
  @value
end

- (Object) transform_rmagick(img)

Rotate and/or flip for proper viewing.



268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/exifr/tiff.rb', line 268

def transform_rmagick(img)
  case @type
  when :TopRight    ; img.flop
  when :BottomRight ; img.rotate(180)
  when :BottomLeft  ; img.flip
  when :LeftTop     ; img.rotate(90).flop
  when :RightTop    ; img.rotate(90)
  when :RightBottom ; img.rotate(270).flop
  when :LeftBottom  ; img.rotate(270)
  else
    img
  end
end