Rahel Gunaratne
Rahel Gunaratne

Reputation: 29

Is there a way to take a screen shot in macOS programmatically?

It seems like all the old frameworks have been deprecated (e.g. CGWindowListCreateImage) in favor of ScreenCaptureKit. Unfortunately it only offers streaming. Is there a simpler way I can get a screenshot of the user's display?

Given displayId, x, y, width and height, I need a function to return the byte data of the desktop screen capture image. It's for a Unity3d native plugin.

I've tried ScreenCapture kit but it's just not right for this use case.

Everything else is deprecated.

Upvotes: 1

Views: 977

Answers (1)

Ikmal Azman
Ikmal Azman

Reputation: 62

Yes, it is, in WWDC 23, ScreenCaptureKit API were introduced to capture screenshots programmatically.

Please refer here :

What’s new in ScreenCaptureKit

https://developer.apple.com/videos/play/wwdc2023/10136/?time=586

Upvotes: 3

Related Questions