Back to main



Auto Screenshot Tool

This is a simple Python script to assist in capturing screenshots from games. Features include:
Automatically creating session-based directories
Multiple capture modes
Works in Windows XP to Windows 11

This is mostly a personal backup, but if it's useful for you, go ahead.

GPL v3

screenshot

Download here Version 1.0.

Known issues: Alt+Printscreen mode is annoying because it takes you out of menus. (No way to actually fix this.) Only works on windows on the primary monitor. (Gives black screens otherwise.)

More details:

You'll need Python, plus the Python libraries for PIL, win32gui, pyautogui, and tkinter.

There are four modes. In Manual mode, the "crop in manual mode" textbox is used. Each number is the number of pixels to crop from each side of the window. For example, "2,17,2,2" would crop two pixels off all sides except the top. I suggest starting with 0s, then opening up the picture and counting pixels. Note that this will, on modern Windows, include the drop shadow area which can vary under some circumstances, so this should be considered fragile. Don't go moving around windows after setting this, and double-check that the resulting captures are the resolution you expect. Next is Game only; this is suitable for most full-screen games, and all windowed games where you don't want the title bar. Ctrl+P mode sends in a literal Ctrl+P keystroke to whatever program you have open. I use this for OBS and BlueStacks, as I've set Ctrl+P to the screenshot button. Note that this does not save the resulting screenshot anywehere, because this program does not take a screenshot in this mode; it assumes the program you're recording has handled that. Alt+Printscreen will hit alt+Printscreen, then save the resulting file. It is suitable for windowed applications where you want to capture the title bar. I suggest increasing the seconds between captures when using this if you need to use Windows-based menus, because when it hits alt+Printscreen, that's a literal key combination, and alt will close menus.

Target window title is a case-insensitive text string that will be searched for in the window's title. It does not need to be complete, but if more than one window matches, it will choose one arbitrarily. This will find the window when you click "Start", then will hold on to that window reference until you hit "Stop", so it is stable through window renames. A recommended use case for this is apps that pop up sub-windows. If a program pops up "settings" in it's own window, with its own titlebar, that's the window that has focus, and you won't capture anything behind that window unless this setting is used.

The Output directory probably doesn't need to be touched, but if you do, just be aware that it understands "~", "{date}", "{time}", and "{session}", and will replace those with appropriate values. "session" refers to an opening of the auto_screen program. It will loop through 0-99 to find the first available directory and use that until the program is closed. If you need to adjust this every time, maybe change the code; this is just a text string, so don't worry about screwing it up.