The black art of resource compression

Apparently resource compression is hard for some people. I’ve always seen it as a fun game — try to pack everything into as little space as possible without significant quality loss.

The resource optimizer included with NVList automatically applies most of the advice from this article. Work with PNG files and super-high bitrate audio all you want, the resource optimizer will automatically pop up during packaging.


Before attempting any type of optimization, first assess the current situation. I like to use windirstat for this. It generates a graphical representation of a folder and everything it contains. Downloads can be found here (no Mac/Linux support, but the download page links to alternatives).

This overview gives you a good idea of the relative size of images vs audio — in this case: red=images, blue=audio. Strangely large files (like a misplaced 20MB PSD) will also stand out clearly.


PNG uses lossless compression — you don’t need lossless compression. Near-lossless is good enough and saves a considerable amount of space. JPEG will only take 25-50% the space of the PNG version even at a very high quality setting. For backgrounds and other images without transparency, prefer JPEG over PNG.

Transparency in images is problematic; JPEG just doesn’t support it. There are however similar formats that do support transparency. NVList supports JNG which stores color as JPEG and transparency using JPEG/PNG. You should never have to create/edit a JNG file, just set the resource optimizer to the ‘size’ preset and it will generate them for you. Ren’Py supports a similar format, JCC which stores color in one JPEG file and the transparency information in a separate JPEG file. Either of these image formats should save around 50% in file size.


Sometimes I’m glad NVList only supports Ogg-Vorbis audio, it makes it harder to screw up. There’s no reason to use any other audio format; MP3/AAC can’t be used due to software patents, Opus lacks software support. FLAC is a good choice for archiving, not so much for a downloadable game. Don’t use uncompressed audio under any circumstance — way too often have I seen 5+ MB sound effects.

As for quality, anything above 160kb/s (VBR) gets quickly diminishing returns.


The choice in packaging format can shave a few megabytes of the final result. The images, audio, video are already highly compressed — you won’t save more than a percent or two for those — but most of the code for the engine isn’t. 7-zip or an installer using the same algorithm (LZMA) can save 5-20MB compared to the .zip version. Installers created with NVList use LZMA and pack200 (a special type of compression for Java code).