PngSnapShot Tutorial

How to save a periodic copy of the screen

"Remember when... ? A computer was something on TV from a science fiction show. A window was something you hated to clean and RAM was the cousin of a goat... Meg was the name of my girlfriend and gig was your middle finger upright. Now they all mean different things and that really mega bytes. An application was for employment. A program was a TV show. A cursor used profanity. A keyboard was a piano. Memory was something that you lost with age. A CD was a bank account. And if you had a 3 1/2" floppy you hoped that nobody found out. Compress was something you did to the garbage not something you did to a file. And if you unzipped anything in public you'd be in jail for awhile. Log on was adding wood to the fire. Hard drive was a long trip on the road. A mouse pad was where a mouse lived and a backup happened to your commode. Cut you did with a pocket knife. Paste you did with glue. A web was a spider's home and a virus was the flu. I guess I'll stick to my pad and paper and the memory in my head. I hear nobody's been killed in a computer crash but when it happens they wish they were dead !"
On this page:

Introduction to PngSnapShot.exe

This is a small utility for unattended screen capture that I use on computers doing real-time acquisition. It takes a snapshot of the screen (or of the currently active window) and saves it to a PNG file. I can then display the PNG file in a browser for web access or archive them for later review.

In other words, this is a screen-capture utility that is designed to be left unattended and to take screen shots at regular intervals.

PNG files (Portable Network Files) uses a lossless compression algorithm and are compatible with IE4, IE5, NS4 and any halfway decent graphic program. PNG files can be B&W, greyscale, 2, 4, 8, 16 bits RGB and can have an optional alpha layer. The files produced by this program are 24bit RGB without alpha layer. PNG is a public domain format and the C source code can be found at the LIBPNG site.

v1.0 — 2000/04/14 — First release.
v1.04 — 2000/06/30 — Minor modifications, added ability to chose the time format string for the archived files.
v1.05 — 2019/06/11 — Published the source code on gitlab (find the PngSnapShot source code there).

User interface of PngSnapShot.exe


The program options are saved in the registry and saved from one run to another, allowing you to call the program from the [Start][Programs][StartUp] folder.

Program options are:

Update period
Interval between snapshots (in seconds)
Location and name of the file. You can point to this file from a web page using <IMG SRC="File.png" ALT="This is the current screen shot">. Note that the SnapShot and the Archive (see below) serve slightly different purposes: you can take snapshots fairly often (say 30 seconds) to display the current status of your system on a webpage and then save only 2 archives a day.
Full screen snapshot or only active window (there is no resizing). Remember not to leave PngSnapShot as the active window, otherwise it will take a snapshot of itself !
Archival directory where to save a copy of the PNG file with a timestamp (File_YYYY-MM-DD_HHhMM.png). This directory is typically configured with directory browse access on a web server.
Number of archives to save per day (1 to 1440). If set to 0, no archives are created. 1440 corresponds to one archive every minute (you'd better have a large disk or a cleanup function...), 24 to one every hour... If you select for instance 48, the archives will be saved at 0:00, 0:30, 1:00, 1:30...
Compression level for the PNG files: 1 (fast and big) to 9 (slow and small), default is 6. This has no influence on image quality since the compression is always lossless.
Resolution in Pix/cm resolution. 28pix/cm is equivalent to 72dpi. Useful only if you plan to do direct printouts.
Optional text information to save in the PNG file. You can view this information by opening the file in a graphic editor like Buy at Amazon.comPaintShopPro or Buy at Amazon.comPhotoShop and using the [Show File Information] option (try it with the image you see here, right-click on it, save it to a temporary folder and edit it). Put whatever you want in those fields, up to 255 characters.
Press this button to do an immediate snapshot. This is used to test the program.
The time tag that's added to the filename saved in the Archive folder. For instance if you set it to %Y%m%d_%Hh%M, with a filename of TEST.PNG, then the archived file will be ArchiveDir/TEST20000131_23h00 for a file saved on 31/1/2000 at 23:00. [Right][Click] on it to have details or see the source code.

Warning 1: the program uses the clipboard as a temporary holder for the image, you should not use cut and paste operations while this program is running !!! It is meant to be used on a PC without user. This is not a bug, but a feature... as I did not find a cleaner solution... Sorry.

Warning 2: this program works only on 16/24/32 bits graphic cards. It will not work on a paletted mode (256 colors or less). I have no plan to change that.

Warning 3: this program will not normally record the image taken by most webcams, video players or DVD players. The reason is that those programs send the image directly to the graphic card and there's no trace of it in the video memory. You need to use a special video capture program for that purpose. Or you can do the following simple workaround: right-click your desktop, [Properties][Settings][Advanced][Troubleshoot] and disable the hardware acceleration by dragging it all the way to the left. Now you can make screen grabs of video outputs.

Warning 4: this program is not intended to be used as a user-activity spying program, as it is not hidden in any way and will interfere with the user rather obnoxiously.

Support my site: make a donation, buy images, use associate services
Download: Yes ! Yes ! Yes ! Where is it ? I want to download it now (1Mb) !

Note: PNG code based on LIBPNG public library
LIBPNG uses the ZLIB library

This freeware written with LabWindows/CVI.