>XGetImage is an obsolete API. You don't want to use that in modern clients.
How is obsolete and what makes XDG portal a better option?
How is obsolete and what makes XDG portal a better option?
Aside from that, it's the slowest and worst possible option in X11 because it copies the pixels into the socket. To handle large images you want to at least use MIT-SHM. XGetImage should only be used as a fallback. Or better, just don't use X11 APIs at all.