Window Capture

(C) 2011-2012 by Antoine VIGNAU and Olivier ZARDINI

> What is Window Capture ?

WindowCapture is a utility focused on screen capture. It has been designed to help in Graphic Resources catching (backgrounds, sprites, animations, palettes...) from games running under emulators.

Unlike Windows native Screenshot functionality (PrintScreen key), WindowCapture capture only the content of a window (not the whole screen) and save the results as image files on disk (file name is auto incremented). No need to enter a graphic program anymore to paste and save. WindowCapture can grab only a small area of the window (remove unwanted borders). Based on the number of colors available in the picture, it will save the image as GIF (256 or less) or BMP (True Colors).

WindowCapture can take One Shot or Record the screen and take pictures on a regular timing (up to 100 pictures / second). This latest feature is useful to get all the sprites used for an character animation.

WindowCapture is part of the Brutal Deluxe's Cross Developpement Tools Project, a full set of utilities available on Windows (and other) platforms to enable the creation of new Apple IIgs software : 65c816 Assembler, 65c816 Disassembler, 65c816 Simulator, Graphic File Converter, Resource Catcher...

WindowCapture is Windows only.

> Quick Tour

Step 1 Download the software (see below) and extract the content of the Archive file (WindowCapture.exe) to your hard drive (anywhere).
Step 2 Launch the software by double clicking the icon
Step 3 You should access the Main window.

Click on the button Settings to access the application parameters.

The button Start is currently disabled because no window has been chosen yet.
Step 4 You should access the Settings window.

Don't need yet to understand all these features.

Just Click on the button Select Window. (Upper right)
Step 5 You should access the Window Selection window.

WindowCapture will display all available Windows on your PC.

Pick one of them and click the button OK.

Here, I have chosen Steem Engine window, an Atari ST Emulator currently running on my PC.
Step 6 The Settings window has been updated :
    - The name of the target window is Steem Engine.
    - The size of the Window in pixels is 396x321.

If you want, you can change the default values for Folder Path (location where the pictures will be created), File Prefix and Suffix Number.

If you leave the parameters as they are, the first picture will be created in the Folder c:\Temp\Pictures\ and the name will be img_0001.bmp.

You can now click the button OK to close the Settings window.
Step 7 The only visible part of the WindowCapture tool is the Main window.

You can notice than the button
Start is now enabled.

Make sure the put the target window (here Steem Engine window) visible.  You can put both windows (application & target) close together.

Click on the button Start to take your first picture.

Step 8 You can notice that the information within the Main window have been updated :
   - The full path (folder + file name) of the picture.
   - The Size of the picture (in pixels)
   - The number of color of the picture

The counter has been incremented. So next picture will be named img_0002.bmp.

If you look into the pictures target folder (here c:\Temp\Pictures\), you should see the picture you have taken few seconds before.

By clicking again on the button Start, you will take other pictures (img_0002.bmp, img_0003.bmp, img_0004.bmp...). They will be displayed in real time by Windows in the target folder.

No need to go back in the Settings window if the parameters are OK.
Step 9 If you look carefully to the picture, you will see that WindowCapture have taken the whole window area, including title bar, menu bar, icon bar...

If you want to capture only the game part of the window, it is time to read the next chapter of this documentation !

> Select Window Area

By default, WindowCapture will take the whole window as final picture :

The first option is to get only the application part of the window, named Client Area :

As you can notice, the application Title bar and most of the window borders have disappeared.
You can ask WindowCapture to get only the Client Area of the window by checking the Get Client Area Only option from the Settings panel :

The size of the Client Area is displayed next to the option check box. The full window size is 396x321, the Client Area part is only 388x294.

Because you probably want to keep only the Game part of the window, you will have to remove extra margins located around the picture : Icon bar + black borders.

You can define the Margins sizes (in Pixels) in the Settings panel. There are four number to provide (Top, Bottom, Left and Right) :


In real time, you can see what would be the size of the final picture (here 320x200). Because the Atari ST low resolution is 320x200, we know we have catch all the screen. You will have probably to do several tests before finding the right numbers for margins size. Once you got them, they will remain the same for all games running on the same emulator. You have to do the job for each emulator you will use. The easy way is to take a screen shot of the Client Area first, and, using a Graphic software, compute the margins size in pixels and put the values in the WindowCapture's Settings panel.

Now that we have the right margins size, the picture taken by WindowCapture fits with the Game screen size :

Defining Margins size helps you also to capture only a small part of the screen, for example where the action takes place, ignoring unwanted background.
In Karateka, the characters only move in a small area of the screen (320x63) :

> Re-Scale Picture

Most of the machines (computer, console, arcades) of the 80's are running 320x200 graphics. So, on today's computer, we usually ask the emulator to double the resolution, to play in a 640x400 window :

By defining the right Margins size, we can get the game area as a 640x400 picture :


Beware, the Margins size are not exactly the double of the 320x200 screen capture session because some part of the Client Area (Icon bar) has not been doubled. Only the Screen part of the emulator has.

If you want the picture to go back to its native resolution (320x200), you may ask WindowCapture to keep only some of the rows / columns. If the resolution has been doubled, keep 1 row out of 2. If the resolution has been tripled, keep 1 row out of 3, etc.
You can control the rescaling of the picture using the Keep 1 Row out of X and the Keep 1 Column out of X options in the Settings panel :

The size of the final picture (here 320x200) is updated in real time, regarding the scale values inserted in the fields.

Once saved on disk, the picture is 320x200 :

> Miscellaneous Settings

Checking the Set as Top-Most option guarantees you that the window you want to capture will stay always visible (put at the top of other windows). It can be useful to prohibit any cover of the window by another one while you are recording a game session.
There are two file formats used in WindowCapture : GIF for 256 or less colors pictures and BMP. We won't save the pictures using JPEG file format because we don't want quality loss format.

GIF is probably the best choice when you are using WindowCapture with vintage systems emulators. Most of the time, the number of colors on the screen is less than 256. The GIF pictures have better compression than BMP so the result files are smaller. If you have asked GIF file format and the picture into the window has more than 256 colors, the WindowCapture will save it as BMP file.

The Clean Folder button is used to remove all consecutive duplicated pictures from the Folder where they have been created. Usually, we run the Clean Folder process after having recorded an animation (see below), to not keep two consecutive pictures to be the same. If the recording frequency is high (> 30 images / seconds) you may have several times the same picture in the target folder. 
The file name of the picture is build using the File Prefix and a Number, incremented after every shot. Based on how you define the first value of this Number, the names of the files will be different.
If you write 1 into the Number field, the files will be named img_1.bmp, img_2.bmp, img_3.bmp, ..., img_10.bmp,..., img_120.bmp, and so on.

If you write 00001 into the Number field, the files will be named img_00001.bmp, img_00002.bmp, img_00003.bmp, ..., img_00010.bmp,..., img_00120.bmp, and so on.

The latest format is more convenient to sort a huge number of files into a folder.
This setting adds a time/date information at the end of the file name : <File Prefix>_<Counter>_<YearMonthDay>_<HourMimuteSecond>_<HundredsOfSeconds>.<Extension>
Example : img_00001_20121118_215806_06.bmp
This is useful for animation recording, to understand how many hundreds of seconds separate two sequential pictures.

> Record Animation

One of the WindowCapture key feature is the capability to record pictures on a regular timing. Because most of the video game system run at maximum 60 frames per seconds, if we get one picture every each 1/60 sec, we are about sure to get all the animation steps. This is mandatory to be sure to get all details.

Let's capture the Karateka middle kick :

If we go into details, we find that this kick is composed of 9 frames :


Once the sprites have been extracted, we drop down to 5 different pictures :

You could have capture these pictures clicking as fast as possible on the Start button of the Main window, but there is a better solution !

You have to check the Set Auto Frames/sec. option available at the bottom of the Settings panel :

So set the number of pictures to capture per second (100 is the maximum, 60 is probably the highest value really useful). If you start with a high value (between 30 and 60 images / second), several sequential pictures would probably be the same.

Once back to the Main window, click on Start button to start recording the animation as a set of pictures. To stop the record of the animation, click again on the Stop button. While recording the pictures, the Counter indicates how many pictures have already been taken and the Elapsed Time give you the duration (in seconds and minutes) of the record :

Beware, the folder receiving the pictures will be quickly filled with hundreds of pictures. Make sure your have enough room to store all of them :

> F.A.Q

Is the Source code available somewhere ?

The Source code is freely available in the Zip file in download section.
It is currently packaged as a Visual Studio 2010 Project set of files. The tool is only using C Language, so you can recompile it with any other C ANSI compiler (GCC...) running on Windows.

What about a Macintosh or Linux release ?

Not on schedule. The program itself uses Windows API everywhere (user graphic interface, system calls...) so porting the software to another platform means rewriting everything.
Another good reason to do not spend too many time on supporting other platforms is linked to the availability of other systems emulators (Atari ST, Amiga, Genesys, Arcade...) mainly on PC.

Do you have any plan to release an Apple IIgs version of KARATEKA soon ?

No. This game was picked only for WindowCapture documentation purpose.

Did you use WindowCapture to get the screenshots displayed on this page ?

No :-[  PrintScreen Key rulez !!!  We avoid recursivity in such projects because of the risk of never ending loop.

> Release Notes

November 19 2012 : WindowCapture v1.0
First public release.

December 8 2012 : WindowCapture v1.1

Add of the button Clean Folder.

> Download

WindowCapture v1.1 for Windows 32 & 64 bits + Source Code                     WindowCapture for Windows