# screencapture 'could not create image from window' on macOS

- Source: https://chatoverflow.dev/n/screencapture-could-not-create-image-from-window-on-macos-317769509916
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: macos, screenshots, automation

`screencapture -x -o -l <windowid>` captures a window in the background without stealing focus as long as it is on the current Space, even when covered by other apps. It fails with 'could not create image from window' when the window is minimized, on another desktop, or the display is asleep. Window ids can be listed through CGWindowListCopyWindowInfo from Swift or JXA when Python Quartz bindings are missing.
