Honey, I shrunk the images: How to reduce image file sizes in your MadCap Flare projects to improve performance and SEO
As technical writers, we focus our efforts on words, but the images we use in our documentation—whether they are screen captures, process diagrams, or product photographs or renderings—are at least as important in conveying our messages. Often, a well designed image can communicate as much as reams of even the best written paragraphs. As the old adage goes, a picture is worth a 1,000 words.
But that doesn’t mean a picture’s file has to be a 1,000 KB in size.
Whether you are using MadCap Flare or another authoring tool, you will find that image files account for most of your source and output files’ overall size. For the most part, this can’t be avoided: image files inherently contain more data than all but the largest text files. But there are ways to shrink your image files. This makes your documentation slimmer and faster to download. It can also improve your documentation’s search engine optimization (SEO).
So how can you reduce the file sizes of images in your Flare projects? Here are some techniques.
Start at the source
When you first create images, whether you are capturing screens using a tool like SnagIt or creating process diagrams using a tool like Visio, you can do several things to minimize the file sizes of those images:
Scale the images in the source application rather than scaling the images in Flare.
Depending on the tool and the file format of the image, you might be able to specify the quality of the image. Lowering the quality can reduce the file size, but the image might appear more grainy as a result.
Experiment with saving the image to different file formats (GIF, JPEG, PNG, and so on). Depending on the nature of the image, some formats can be significantly smaller than others.
Remove file properties and personal information. This has the added benefit of removing information from the images that you might not want to make publicly available.
Use Flare’s “Generate resized copies of scaled images” option
If using source tools to reduce image sizes isn’t an option or if you’re finding the above techniques don’t reduce image file sizes enough, an alternative is to select the “Generate resized copies of scaled images” check box (under Advanced) in your project’s target files:
If you select this check box and then build an output, Flare creates a new version of each scaled image in the output. This image can be substantially smaller than the original in cases where you reduce the dimensions of images in Flare:
The trade-off is that Flare includes both the original image and the resized image in the output, which can increase the overall footprint of your output. This technique also only works on images that you scale in Flare. If you don’t change the dimensions of an image in Flare, this technique will not create a smaller copy of the image.
Use an image compressor
A third technique you can use to reduce the file sizes of images in your Flare outputs is to use an image compressor like Tinify or Online Image Compressor.
If you have a small number of images for which you need to reduce file sizes, you can simply drag and drop these images into these tools’ online interfaces. You can then download the compressed image files and copy and paste them over the originals in your Flare projects.
If you have many images or would just like to automate the process of reducing image files, I have created a set of Python scripts that uses the Tinify API. You can run the scripts using your target files’ pre- and post-build event commands. I’ve complied these scripts along with instructions into a Flare project that is available in GitHub.
I’ve set up the scripts so that you can compress source images in your project’s Content folder or generated images in your HTML outputs. You can also set a minimum file size for images to be compressed and exclude images that reside in specified folders from being compressed.
Get the same for less
Most of the techniques I describe above will not adversely affect the quality of your images. They simply compress the file sizes of the images, reducing their footprint on your servers and making them faster to download.
Reducing the file sizes of images is a simple but effective way of getting the same for less out of your Flare projects.