lib/rapinoe/keynote.rb in rapinoe-0.0.2 vs lib/rapinoe/keynote.rb in rapinoe-0.0.3

- old
+ new

@@ -23,9 +23,31 @@ # Returns the file size of the Keynote file in bytes. def size File.size(path) end + # The aspect ratio of the deck. + # + # Returns a Symbol, either :widescreen or :standard (4:3). + def aspect_ratio + path = "/tmp/rapinoe-aspect" + write_preview_to_file(path) + + dimensions = FastImage.size(path) + widescreen = (16/9.0) + + if widescreen == (dimensions[0] / dimensions[1].to_f) + :widescreen + else + :standard + end + end + + # Is it widescreen? Does it blend? + def widescreen? + aspect_ratio == :widescreen + end + def slides @data.glob("Data/st*").map do |preview_jpg_data| Slide.new(preview_jpg_data.get_input_stream.read) end end