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:



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

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

Instance Method Details

#==(other) ⇒ Object

:nodoc:



298
299
300
# File 'lib/exifr/tiff.rb', line 298

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

#inspectObject

Debugging output.



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

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

#to_iObject

Field value.



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

def to_i
  @value
end

#to_symObject

Symbolic value.



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

def to_sym
  @type
end

#transform_rmagick(img) ⇒ Object

Rotate and/or flip for proper viewing.



284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/exifr/tiff.rb', line 284

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