0

I have some code to create screenshots. On High Sierra it worked without issues. However, it does not work anymore properly since I run it on Mojave. Some parts are cut out. I use this API call:

CGImageRef screenshot = CGWindowListCreateImage
(CGRectInfinite, kCGWindowListOptionOnScreenOnly, kCGNullWindowID, kCGWindowImageDefault);

This option didn't work too kCGWindowListOptionAll. Attached are snippets of the screenshots with regions that are just white, i.e. missing. Note, I have intentionally removed the docker part below. I would actually just want to create plain full-screen snapshots.

Furthermore, even using the command line tool screencapture the the result is the same. Any ideas? Do I need to give certain permissions in "Security & Privacy"?

enter image description here

enter image description here

Pang
  • 9,564
  • 146
  • 81
  • 122
tr4px
  • 29
  • 1
  • 5
  • No attachments! –  Apr 23 '19 at 16:58
  • @ankiiiiiii I just added them – tr4px Apr 23 '19 at 17:04
  • Can you update your question with an example of `screencapture` failing like that? Are you by chance using the `-l ` option? – Asmus Apr 23 '19 at 22:05
  • Does `CGDisplayCreateImage()` capture those missing areas? – Ken Thomases Apr 23 '19 at 23:27
  • @Asmus I just did `screencapture shot.jpg` – tr4px Apr 24 '19 at 07:16
  • @KenThomases Using this had the same effect. A side note: no monitor is attached to the Mac Mini. I do the screenshot via VNC. – tr4px Apr 24 '19 at 07:17
  • If you take a "normal" screenshot (i.e. using cmd+shift+3), is it also producing white areas? What's in these regions (i.e. which app)? – Asmus Apr 24 '19 at 07:20
  • SOLUTION: The issue was that no monitor was attached. In this case, macOS does not capture all regions/windows. As soon as I attached a monitor or KVM, everything worked fine. This seems to be bug. – tr4px Apr 24 '19 at 08:37

0 Answers0