Skip to content

Robust multi-monitor screenshot grabber (Windows-only right now)

License

Notifications You must be signed in to change notification settings

chriskiehl/Desktopmagic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Desktopmagic overview

Desktopmagic can take screenshots (Windows-only for now) without leaking memory in any type of error case (locked workstation, no monitor attached, etc).

You may want this instead of PIL's ImageGrab because:

  • This takes a screenshot of all monitors.

  • PIL leaks memory if you try to take a screenshot when the workstation is locked (as of 2011-01).

Requirements

Installation

python setup.py install

This installs the module desktopmagic and the script screengrab_torture_test.

Sample use

desktopmagic.screengrab_win32.getScreenAsImage() returns a PIL Image object (mode RGB) of the current screen (all monitors).

You can save it to disk:

from desktopmagic.screengrab_win32 import getScreenAsImage

im = getScreenAsImage()
im.save('screencapture.png', format='png')

desktopmagic.screengrab_win32.saveScreenToBmp(bmpFilename) saves a screenshot (all monitors) to a .bmp file. This does not require PIL. The .bmp file will have the same bit-depth as the screen; it is not guaranteed to be 32-bit. You'll get an probably-unreadable BMP if your screen depth is 256 colors.

See the source for more advanced/raw usage.

Wishlist

  • Support taking screenshots of just one monitor.

  • Support OS X

  • Support Linux

  • Write some tests

Contributing

Patches and pull requests are welcome.

This coding standard applies: http://ludios.org/coding-standard/

About

Robust multi-monitor screenshot grabber (Windows-only right now)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.0%
  • Scala 1.0%