lib/yamg/screenshot.rb in yamg-0.3.3 vs lib/yamg/screenshot.rb in yamg-0.3.5
- old
+ new
@@ -1,8 +1,5 @@
-require 'screencap'
-# require 'smartshot'
-
module YAMG
#
# Screenshot from multiple providers
#
class Screenshot
@@ -14,23 +11,21 @@
fail 'No screen size provided' unless opts['size']
uri = URI.parse(opts['url'])
@url = "http://#{uri}"
@size = opts['size']
@size = @size.split(/\s?,\s?/) if @size.respond_to?(:split)
- # @fetcher = Smartshot::Screenshot.new(window_size: @size)
+ @dpi = opts['dpi']
@fetcher = Screencap::Fetcher.new(@url)
end
def android
# adb -e shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png
end
# Take the screenshot
# Do we need pixel depth??
def work(path)
- # visit(url)
- # page.save_screenshot("#{path}/#{@name}.png")
- # @fetcher.take_screenshot!(url: url, output: "#{path}/#{@name}.png")
- @fetcher.fetch(output: "#{path}/#{@name}.png", width: @size[0], height: @size[1])
+ out = "#{path}/#{@name}.png"
+ @fetcher.fetch(output: out, width: @size[0], height: @size[1], dpi: @dpi)
end
end
end