On Windows, the cheapest path is .NET's Graphics.CopyFromScreen, three lines of code that copy the primary display's device context into a bitmap object, which is why it shows up constantly in PowerShell-based stealers and commodity RATs: no compiled binary is needed, just a script block loading System.Drawing. The lower-level equivalent is the GDI pair GetDC plus BitBlt, which native malware favors because it avoids spinning up the .NET runtime and leaves a smaller footprint. Either way the output is a raw bitmap that the malware then encodes to PNG or JPEG, usually with GdipSaveImageToStream, before it touches disk.
A second, quieter path abuses what is already installed: Psr.exe, the Windows Problem Steps Recorder, ships signed on every modern Windows box and will record the screen (plus mouse clicks) to an MHTML file when launched with /start. Because it is a legitimate Microsoft binary, it passes most application allow-lists that would block an unknown screenshot utility outright, and it has been used this way since at least 2019 per the LOLBAS project.
On the infostealer side, the pattern is mechanical rather than interactive: the malware fires once on execution or on a timer, saves the capture as screenshot.png, screenshot.jpg, or screenshot.bmp into %TEMP% or a similarly writable path, bundles it with harvested browser data and wallet files, and ships the archive to C2 within seconds. Linux and macOS variants use xwd against the root window or the native screencapture utility respectively, but the Windows temp-drop pattern is by far the most common in commodity stealer families.