win32screenshot 1.0.0 - The New Beginning

J

Jarmo Pertman

Capture Screenshots on Windows with Ruby to bmp, gif, jpg or png
formats!
======

win32screenshot has finally made it to the version 1.0.0 (that's
partly because Semantic Versioning (http://semver.org) rules are being
followed).

It's taken over 4 years to arrive to that version number and i'm
pretty happy with the results.

Install it with `gem install win32screenshot` and start using.


What's so special about this version?
======

* With the previous versions of win32screenshot you had to have
installed ImageMagick and RMagick to save pictures into some other
format than bmp. I think everyone who has walked that path knows how
pain-in-the-*** these things feel. Starting from this version
ImageMagick and RMagick are not needed to have to be installed! All
necessary ImageMagick libraries/binaries are bundled with the gem to
allow saving screenshots into bmp, gif, jpg and png formats.

* The API got changed a lot (meaning that this version is backwards
incompatible), hopefully to the better. Check out the examples below:

require 'win32/screenshot'

# Take a screenshot of the window with the specified title
Win32::Screenshot::Take.of:)window, :title => "Windows Internet
Explorer").write("image.bmp")

# Take a screenshot of the foreground
Win32::Screenshot::Take.of:)foreground).write("image.png")

# Take a screenshot of the specified window's top-left corner's area
Win32::Screenshot::Take.of:)window, :title => /internet/i, :area =>
[10, 10, 20, 20]).write("image.jpg")

# Take a screenshot of the window with the specified handle
Win32::Screenshot::Take.of:)window, :hwnd =>
123456).write("image.gif")

# Take a screenshot of the child window with the specified internal
class name
Win32::Screenshot::Take.of:)rautomation,
RAutomation::Window.new:)hwnd => 123456).
child:)class => "Internet
Explorer_Server")).write("image.png")

# Use the bitmap blob for something else
image = Win32::Screenshot::Take.of:)window, :hwnd => 123456)
image.height # => height of the image
image.width # => width of the image
image.bitmap # => bitmap blob


Changelog:

* Bundling all necessary libraries/binaries with the gem - ImageMagick
and RMagick are no more needed, finally!
* Using MiniMagick to save images to gif, jpg and png format
* Simplified and deleted a lot of code causing backwards
incompatibility and major API changes!
Refer to the README.rdoc and documentation for the overview of the
new and better API
* From now on this library is following Semantic Versioning (http://
semver.org) rules

Check out the source code at https://github.com/jarmo/win32screenshot

Jarmo Pertman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top