What pngquant does and why you might need it

Pngquant is a command-line tool that shrinks PNG image files without losing much visible quality. It reduces file size by limiting the number of colors in an image — useful if you're building a website, managing a photo library, or preparing images for email. On Windows, you install it once and then run it from the command prompt whenever you need to compress a batch of images.

The tool works best on images with fewer than 256 distinct colors — logos, screenshots, straightforward graphics. Photographs with gradients and many colors still compress, but the quality loss becomes visible. Most people use pngquant as part of a workflow: install it, then call it from a script or batch file to process multiple images at once.

Key Takeaways

  • Pngquant installs via a Windows installer you read from the official GitHub releases page, not through the Microsoft Store or a package manager.
  • The installation adds pngquant to your system PATH, so you can run it from any command prompt window by typing pngquant followed by the image filename.
  • After installation, test the tool by opening Command Prompt and typing pngquant --version to confirm it works.
  • Basic usage is pngquant 256 input.png to reduce an image to 256 colors, or pngquant 64 input.png for more aggressive compression.

Downloading the Windows installer

Go to the pngquant GitHub releases page at github.com/kornelski/pngquant/releases. Scroll down to find the latest release — look for a version number like "2.20.1" or higher. Under the "Assets" section, find the file named pngquant-windows.zip or similar (the exact name changes with each release, but it will say "windows" in the filename).

Click the filename to read it. The file is usually 1 to 3 megabytes. Save it to your Downloads folder or anywhere you can find it easily. Do not open it yet — you'll extract it first.

Extracting and installing the executable

Right-click the downloaded ZIP file and select "Extract All". Windows will ask you where to extract the files. Choose a permanent location — not your Downloads folder, which you might empty later. A good choice is C:\Program Files\pngquant or C:\Users\[YourUsername]\AppData\Local\pngquant.

After extraction, open the folder. You should see a file named pngquant.exe (it may show as just "pngquant" if Windows hides file extensions). This is the tool itself. Do not move or delete this file — it needs to stay in the folder you chose.

Now you need to add this folder to your system PATH so Windows can find pngquant from any command prompt. Right-click "This PC" or "My Computer" on your desktop or in File Explorer, then select "Properties". Click "Advanced system settings" on the left side. In the window that opens, click the "Environment Variables" button near the bottom.

In the Environment Variables window, under "User variables" or "System variables", click "Path" and then click "Edit". Click "New" and type the full path to your pngquant folder — for example, C:\Program Files\pngquant. Click OK three times to close all the windows. You may need to restart your computer for the change to take effect.

Testing the installation

Open Command Prompt by pressing Windows key + R, typing cmd, and pressing Enter. Type pngquant --version and press Enter. If the installation worked, you'll see a version number like "2.20.1" printed on the screen. If you see "pngquant is not recognized", the PATH was not set correctly — go back and check that you typed the folder path exactly right, and restart your computer if you haven't already.

Once you see the version number, pngquant is ready to use. You can close Command Prompt.

Using pngquant from the command line

To compress an image, open Command Prompt and navigate to the folder containing your PNG file. Type pngquant 256 filename.png and press Enter, replacing "filename.png" with your actual image name. The tool creates a new file called filename-fs8.png (the original stays unchanged).

The number 256 means "reduce to 256 colors". You can use smaller numbers for more compression: pngquant 128 filename.png uses 128 colors, pngquant 64 filename.png uses 64 colors. Fewer colors mean smaller files but more visible color banding, especially in photographs. Start with 256 and lower it only if the file size is still too large.

To process multiple files at once, use a wildcard: pngquant 256 *.png compresses every PNG in the current folder. Each output file gets the "-fs8" suffix added to its name.

Troubleshooting common problems

If Command Prompt says "filename.png: No such file or directory", you're in the wrong folder. Use cd C:\path\to\your\images to navigate to the folder where your PNG files are stored, then try the pngquant command again.

If the compressed image looks worse than you expected, try a higher color count: pngquant 256 filename.png instead of 64 or 128. For photographs, pngquant may not be the right tool — consider using a different image compressor like ImageMagick or online tools designed for photo compression.

If you need to uninstall pngquant, delete the folder you extracted it to and remove that folder path from your Environment Variables. The tool leaves no other files on your system.

Frequently Asked Questions

Can I use pngquant in a batch file or script?

Yes. Once pngquant is in your PATH, you can call it from a batch file (.bat) or PowerShell script. For example, a batch file containing pngquant 256 *.png will compress all PNG files in that folder when you run it. This is useful for automating image processing workflows.

Does pngquant work on JPG or other image formats?

No, pngquant only works on PNG files. For JPG compression, use a different tool like ImageMagick or online JPG compressors. Pngquant is designed specifically for PNG's color-palette mode.

Will pngquant delete my original image?

No. Pngquant always creates a new file with "-fs8" added to the name and leaves your original unchanged. You can delete the new file if you don't like the result, and your original is still there.

What does the "-fs8" in the output filename mean?

It indicates that pngquant used its "Floyd-Steinberg" dithering algorithm (fs) with 8-bit color depth. You can rename the output file to remove this suffix if you prefer a simpler name.