{"id":25511320,"url":"https://github.com/ludios/desktopmagic","last_synced_at":"2025-04-10T16:32:43.375Z","repository":{"id":1456803,"uuid":"1691247","full_name":"ludios/Desktopmagic","owner":"ludios","description":"Robust multi-monitor screenshot grabbing library for Python 2.x/3.x on Windows","archived":false,"fork":false,"pushed_at":"2020-11-08T08:07:51.000Z","size":60,"stargazers_count":59,"open_issues_count":6,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T14:21:16.396Z","etag":null,"topics":["monitor","screenshot","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ludios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-05-02T13:12:25.000Z","updated_at":"2024-06-23T05:18:14.000Z","dependencies_parsed_at":"2022-07-29T14:09:04.240Z","dependency_job_id":null,"html_url":"https://github.com/ludios/Desktopmagic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludios%2FDesktopmagic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludios%2FDesktopmagic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludios%2FDesktopmagic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludios%2FDesktopmagic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ludios","download_url":"https://codeload.github.com/ludios/Desktopmagic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248252696,"owners_count":21072701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["monitor","screenshot","windows"],"created_at":"2025-02-19T10:32:09.941Z","updated_at":"2025-04-10T16:32:43.351Z","avatar_url":"https://github.com/ludios.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Desktopmagic\n============\n\nDesktopmagic takes screenshots on Windows.  It supports any\narrangement of multiple monitors, and does not leak memory in any\nfailure mode (locked workstation, no monitor attached, etc).  If you wish,\nit can be used continuously to take millions of screenshots.\n\nYou may want this instead of PIL's ImageGrab because:\n\n*\tDesktopmagic can take a screenshot of all monitors.  You can:\n\n\t*\tTake a screenshot of the entire virtual screen.\n\n\t*\tTake a screenshot of the entire virtual screen, split into one PIL Image per display.\n\n\t*\tTake a screenshot of just one display.\n\n\t*\tTake a screenshot of an arbitrary region of the virtual screen.\n\n\t(See below for usage)\n\n*\tImageGrab leaks memory if you try to take a screenshot when the\n\tworkstation is locked (as of 2011-01).\n\n\n\n## Requirements\n\n*\tPython 2.6, 2.7, or 3.3+\n\n*\tpywin32: http://sourceforge.net/projects/pywin32/files/pywin32/\n\n*\tPIL or Pillow, unless you don't need\n\t`getScreenAsImage`, `getDisplaysAsImages`, or `getRectAsImage`.\n\n\t*\tPIL: http://www.pythonware.com/products/pil/\n\n\t*\tPillow: https://pypi.python.org/pypi/Pillow/\n\n\n\n## Installation\n\n```\npip install --user Desktopmagic\n```\n\nor:\n\n```\ngit clone https://github.com/ludios/Desktopmagic\ncd Desktopmagic\npip install --user .\n```\n\nor without pip:\n\n```\npython setup.py install --user\n```\n\nThis installs the module `desktopmagic` and the script `screengrab_torture_test`.\n\n\n\n## Examples\n\n```py\nfrom __future__ import print_function\n\nfrom desktopmagic.screengrab_win32 import (\n\tgetDisplayRects, saveScreenToBmp, saveRectToBmp, getScreenAsImage,\n\tgetRectAsImage, getDisplaysAsImages)\n\n# Save the entire virtual screen as a BMP (no PIL required)\nsaveScreenToBmp('screencapture_entire.bmp')\n\n# Save an arbitrary rectangle of the virtual screen as a BMP (no PIL required)\nsaveRectToBmp('screencapture_256_256.bmp', rect=(0, 0, 256, 256))\n\n# Save the entire virtual screen as a PNG\nentireScreen = getScreenAsImage()\nentireScreen.save('screencapture_entire.png', format='png')\n\n# Get bounding rectangles for all displays, in display order\nprint(\"Display rects are:\", getDisplayRects())\n# -\u003e something like [(0, 0, 1280, 1024), (-1280, 0, 0, 1024), (1280, -176, 3200, 1024)]\n\n# Capture an arbitrary rectangle of the virtual screen: (left, top, right, bottom)\nrect256 = getRectAsImage((0, 0, 256, 256))\nrect256.save('screencapture_256_256.png', format='png')\n\n# Unsynchronized capture, one display at a time.\n# If you need all displays, use getDisplaysAsImages() instead.\nfor displayNumber, rect in enumerate(getDisplayRects(), 1):\n\timDisplay = getRectAsImage(rect)\n\timDisplay.save('screencapture_unsync_display_%d.png' % (displayNumber,), format='png')\n\n# Synchronized capture, entire virtual screen at once, cropped to one Image per display.\nfor displayNumber, im in enumerate(getDisplaysAsImages(), 1):\n\tim.save('screencapture_sync_display_%d.png' % (displayNumber,), format='png')\n```\n\nFor more information, see the docstrings in https://github.com/ludios/Desktopmagic/blob/master/desktopmagic/screengrab_win32.py\n\n\n\n## Known issues\n\n*\tScreenshots are incorrectly cropped on high-DPI displays.  Windows returns\n\tdisplay geometry data scaled for the DPI, while the actual screenshots are\n\tunscaled.  Workaround: Right-click on python.exe, Properties, Compatibility\n\ttab, check 'Disable display scaling on high DPI settings'.  Repeat for pythonw.exe.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fludios%2Fdesktopmagic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fludios%2Fdesktopmagic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fludios%2Fdesktopmagic/lists"}