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

#initialize(value, type) ⇒ Orientation

:nodoc:



268
269
270
# File 'lib/exifr/tiff.rb', line 268

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

Instance Method Details

#==(other) ⇒ Object

:nodoc:



302
303
304
# File 'lib/exifr/tiff.rb', line 302

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

#inspectObject

Debugging output.



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

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

#to_iObject

Field value.



273
274
275
# File 'lib/exifr/tiff.rb', line 273

def to_i
  @value
end

#to_symObject

Symbolic value.



278
279
280
# File 'lib/exifr/tiff.rb', line 278

def to_sym
  @type
end

#transform_rmagick(img) ⇒ Object

Rotate and/or flip for proper viewing.



288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/exifr/tiff.rb', line 288

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