How to reduce the size of modules

This page is for module designers who need tips on reducing the size of their modules. Some of the tips can have a dramatic effect, others less so. Maps typically make up the largest part of any module, followed by Rule tables and Charts. Small decreases in counter size can have a major effect in large modules that might contain thousands of counter images.

First things first

The module file might have a name ending with .vmod. However, to manipulate your module as a zip file, you might have to change its extension (at least in Windows).

Remove old versions of images

As you build up your module, you copy additional images into the ‘images’ sub-folder within your module zip file. If you change the name of any images, the old versions of those images will not be deleted unless you specifically delete them.

You can remove unused images in the Editor. Select “Remove Unused Images” from the Tools menu. Be sure to make a backup copy of your module before using the Removed Unused Images tool.

Benefit can be large, especially if there are a couple of copies of old maps still in the module!

Optimize your PNG images

Most programs which write PNG images do not write them with the smallest file size possible. Run a PNG optimizer (e.g., optipng) on your PNG images to reduce their file size without altering their image content.

PNG optimizers remove alpha channels from images which have no transparency, reduce the bit depth of images which use few colors, and recompress the image data tighter, resulting in smaller PNG files which are still equivalent to the orignals.

Benefit is often large.

Re-zip your module

Modules are ZIP archives. If files in your module were not compressed with maximum compression, you might be able to reduce the size of your module by recompressing on a higher compression setting.

Unzip your module and rezip it using a ZIP program such as 7zip, and select the highest compression level available.

Benefit small to medium, but likely very little if you have already optimized your PNG images.

Image Color Depth

Bitmap images reserve a particular number of bits for each color channel (and possibly also for the alpha channel, used for transparency) for each pixel. The number of bits per pixel determines how many colors can be represented in an image. Typical PNG images these days are 24 bits per pixel for the colors (8 bits each for red, green, and blue) and optionally 8 bits for transparency.

You can dramatically reduce the file size of an image by reducing the color depth to 8 bits per pixel, but the tradeoff is that at 8 bits per pixel, your image may contain at most 256 colors—far, far less than the 16.7 million colors you can have at 24 bits per pixel.

Reducing the color depth of an image which has more than 256 colors in it to only 256 colors will typically make it look like garbage and we strongly recommend against doing this. No one will thank you for making the game map look bad in order to shave a few megabytes off your module.

However, if your image already has 256 colors or fewer in it, running it through a PNG optimizer can reduce the color depth without removing any colors, which will reduce the file size at no cost to appearance. We recommend letting a PNG optimizer do this work for you rather than manually modifying the bit depth of your images.