lib/lolcommits/runner.rb in lolcommits-0.3.4 vs lib/lolcommits/runner.rb in lolcommits-0.4.0.pre1
- old
+ new
@@ -1,8 +1,7 @@
module Lolcommits
PLUGINS = Lolcommits::Plugin.subclasses
- include Magick
class Runner
attr_accessor :capture_delay, :capture_device, :message, :sha,
:snapshot_loc, :main_image, :repo, :config, :repo_internal_path
@@ -59,14 +58,19 @@
end
end
end
def resize_snapshot!
- canvas = ImageList.new(self.snapshot_loc)
- if (canvas.columns > 640 || canvas.rows > 480)
- canvas.resize_to_fill!(640,480)
+ image = MiniMagick::Image.open(self.snapshot_loc)
+ if (image[:width] > 640 || image[:height] > 480)
+ #this is ghetto resize-to-fill
+ image.combine_options do |c|
+ c.resize '640x480^'
+ c.gravity 'center'
+ c.extent '640x480'
+ end
+ image.write self.snapshot_loc
end
- canvas.write(self.snapshot_loc)
FileUtils.cp(self.snapshot_loc, self.main_image)
end
def cleanup!
#clean up the captured image