This post is one part of the Watchdog Series.
Compression

The next step is necessary because we had to use BMP (instead of PNG) as output format. There are two reasons for that:

  1. We could not use PNG because of problems with the transparency channel.
    You’ll find more details in the problem section.
  2. Not all screenshots must be PNG. For some it’s useful to use the even smaller JPG format (explained below)

PNG, BMP, JPG??? It’s easy: To automatically compare images we need a format which is stored with lossless compression to not have too many pixel changes due compression artifacts:

We could just use the BMP format (not compressed at all) but a BMP file (1280×720, 32Bit) needs ~3.5 MB which is too much if you take ~1900 screenshots every night.
Also some of our screenshots can be stored as JPG which again saves some space. PNG on the other side is compressed but this happens lossless!

Comparable?

But which screenshots should be saved as PNG (comparable through loss-less compression) and which as JPG (not comparable but small filesize)?

Here you see an example showing scenes which you can not compare due moving stuff and randomization. These screenshots can be stored as JPG and only serve as archive:

If we want compare screenshots we need special static scenes like below. The screenshots will be stored as PNG:

Bait for the Dog

Do you remember that we can define the foldername in our game script? The “bait_” in the name tells our Watchdog Script which screenshots shall be compared (and therefore stored as PNG) and which are just for the archive (JPG).

<signal_cue_instantly cue=”AddDirectory” param=”‘bait_ads.arcade2_title'”/>

We convert our images via ImageMagick. Here’s an example of how we start the program (I shortened the images-names in the example to fit them into one line):

convert.exe screen.BMP -alpha off -scale 1280 screen.JPG

You may ask, what this -alpha off option does. Well, we had to throw away the alpha because debug text and the Steam Overlay were written into it. Read more about this here.

At this point we additionally create thumbnails which we’ll use as previews for the HTML Gallery and Mails later. Thumbnails are always stored as JPG.

The last step is to delete the BMP.

Now we are ready! We have saved a lot space on the hard drive and the “bait_”-screenshots are in a format which can be compared.

Continue with the next part: Compare screenshots.

Leave a Reply

Your email address will not be published.