How to reduce the size of a PNG while retaining transparency

PNGIconXMany images that you create or otherwise handle in OS X will be in the PNG format. These can be screenshots, or built-in images that are part of programs or other system resources. PNG supports an alpha channel so you can have transparent regions of an image (great for displaying on different backgrounds); however, the PNG format was intended to be a lossless format, so its inherent compression abilities are limited.

As a result, if you have a PNG with transparencies, then you might find yourself facing two possibilities for reducing its size using standard programs like Preview. The first is to change its dimensions to reduce the number of pixels in it, and the second is to save it without transparency, which is some cases may not be desired. Even if you could live without the transparencies, using a more optimized lossy format like JPEG would be the best approach.

In order to keep your PNG and its transparencies, but still reduce its size, you will have to force the use of a lossy compression algorithm. This can be done in PNGs with a program like ImageAlpha. As with any image processing that uses lossy algorithms, by using ImageAlpha you will be sacrificing image quality for the sake of file size; however, you can try several algorithms and settings in the program to find the middle ground that will work best for your image.

ImageAlpha in OS X

When applying the algorithms using the controls on the left, you can see the results in the preview window. Note that sometimes quality issues can be subtle, like the gradient grain introduced here. Note that the size of the image here is 76% smaller than its original, which even given the lower quality, may still be worth it (click image for larger view and to see the details noted).

ImageAlpha offers four lossy algorithms to choose from: Median Cut, NeuQuant, Blurizer, and Posterizer. Without going into details about these, they basically offer ways to blend pixels in a reduced color pallet. For each, you will then have a slider for reducing the color pallet from 24-bit to 8-bit, 7-bit, 6-bit, and so-on. You can then select whether to dither (randomly blend) the image pixels for intermediate colors, or have intermediate color blends stay in fixed patterns.

Note that the impact of these visual artifacts will be greater for smaller images (ie, one that is 100 x 100 pixels), and be less of an issue for large images with massive amounts of pixels that can be more easily blended using these algorithms.

By using these options in ImageAlpha, you can retain a good looking PNG file while reducing its size to about 25-30 percent of its original. Granted this is not as great as using an optimized lossy format like JPEG, but it will allow you to reduce your image size while keeping properties like transparency.

2 thoughts on “How to reduce the size of a PNG while retaining transparency

    1. Topher Kessler

      There are a number of online tools that can do this; however, most will not allow you to preview the result and apply different settings levels.

Comments are closed.