Software Engineering

Optimizing Raster Images for Web

A raster image is a grid of pixels. Each pixel contains colour and transparency information.

Image compression is a type of data compression is a type of data compression that is applied to digital images. Compression helps make file sizes smaller for both storage and transmission. Many algorithms exist that that advantage of the human eye's perception and statistical properties of image data. Eg. losing some image clarity in favour of smaller file size.

While some popular programs have a "Save for web" feature, there are many alternatives that are even better suited for batch processing (and use different algorithms so you can experiment!).

Compression Tools


  • ImageOptim Online
  • TinyPNG - Has a paid Photoshop plugin as well as a developer API with official client libraries for Ruby, PHP, Node.js, Python, Java and .NET.

Command Line

  • pngquant - Windows-compatible GUI applications and Photoshop plugins are available.
  • Google Zopfli compression algorithm, a library programmed in C to perform good, but slow, zlib compression.
  • Lossy Gifsicle


  • PNGGauntlet is a piece of software that combines PNGOUT, OptiPNG, and DeflOpt to create the smallest PNGs without any loss in image quality.



  • ImageOptim (Mac) is free, open source software that combines MozJPEG, Pngcrush, pngquant, 7zip and Google Zopfli.
Enjoying this content? Subscribe for more
Subscribe now

Subscribe to be notified of new content and support Pinky promise that I won't sell your email.