Platinum Partner

Screenshots - Ruby

Requires - Win32Screenshot Or RMagick
You can uncomment corresponding code if using RMagick. This script is ready to take screenshots on a Win32 System. Users can opt to use RMagick on //other Platforms. (Considering RMagick installation over Win32 platform is complicated).


require 'win32screenshot'
#require 'RMagick'
 
t = Time.now
str = t.strftime("%Y%m%d_%H%M%S")
 
# Take Foreground Screenshot
# width, height, bmp = Win32::Screenshot.foreground
# Take Desktop Screenshot

width, height, bmp = Win32::Screenshot.desktop

# Take Application Window Screenshot
# width, height, bmp = Win32::Screenshot.window(/Firefox/)
 
img_path = ARGV[0] || "file_#{str}.bmp"

File.open(img_path, "wb") {  |io| 
  io.write(bmp)
}
 
# img = Magick::Image.from_blob(bmp)[0]
# dir and spec number are defined outside
# img_path = img_path + ".png" 
# img.write(img_path)
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}