Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Desktop Screenshots for GameMaker

Capture part/whole screen/all screens inside or outside of your GM games · By YellowAfterlife

Does it work async to take a screenshot of full desktop?

A topic by marcioramos created Apr 08, 2025 Views: 86 Replies: 2
Viewing posts 1 to 3

Hi! 

I know GM has the screen_save feature, but it hangs (lags?) the game while saving. I think a solution would be an external screenshooter. Something that I can call with a path+filename argument and it saves the screen or part of it (even re-scale it would be great).
Does your  Screenshot program do it? Would it screenshot without making the program/game/runner lag?

Really good to see all your great work, man! Keep up with your creativity feeding GM community with great tools!

Developer

Without knowing your project specifics, I’m willing to guess that it’s not screen capture that’s slow, but rather writing a large PNG file - you can test this by loading the file back as a sprite, drawing it on a surface, and calling surface_save.

GML has a buffer_compress function that you can use to make your own PNG encoder, but it does not expose the underlying zlib functions for compressing a portion of data at the time, so whatever you make won’t be any better than existing surface_save - has to be a native extension doing either this or saving on a separate thread in general.

Or maybe you can write 32-bit BMP files instead - these have a basic header followed by RGBA bytes that are stored upside-down (bottom row first).

(1 edit)

My need screencapture is this: I need to screenshot a dualview desktop, each 1920x1080. Total = 1920x2160 (one on top of the other).
You are right. The problem lies on the moment of disk access.  
I found a solution. Making an async call (libxprocess>ProcessExecuteAsync) to an external screenshot.exe, to wich I send the path I want it to save the jpeg file.
Works perfectly!!
Now I just have to find one screenshooter that works fine as well on Linux (Wayland).