Neil Turner's Blog

Blogging about technology and randomness since 2002

Quickly compress PNG images

Screenshot of the 'Crush' context command Before posting any PNG images on here, I use the open source Pngcrush tool to compress the images as much as possible first. Even when I set the compression to its highest value in programs like IrfanView, Pngcrush is still able to make most images even smaller.

Unfortunately Pngcrush is a command-line tool, so it’s not the easiest tool to use in Windows. So here’s how to add a ‘Crush’ option to the context (right-click) menu in Windows Explorer for quicker crushing.

Firstly, you’ll need to download Pngcrush, which is availble at Sourceforge. You’ll want the win32 version. Download it and unpack it somewhere.

The instructions that follow are for Windows XP; for older versions they’ll be a little different.
Open Control Panel and choose Folder Options. Select the File Types tab, and scroll down to the ‘PNG’ entry. Click on ‘Advanced’, then click on ‘New…’.

In ‘Action’, type Crush, and in ‘Application used to perform action’, type the following:

C:\Downloads\pngcrush\pngcrush.exe -e 2.png "%1"

The first portion should be the location of the pngcrush.exe file that you extracted from the archive. The ‘-e 2.png’ bit specifies what the outputted PNG image will be called, which in the case it’ll be the filename with ‘2’ appended to it (so the crushed version of ‘catpicture.png’ would be called ‘catpicture2.png’). You could also use the following:

C:\Downloads\pngcrush\pngcrush.exe -brute -e 2.png "%1"

This does the same as the above but does a ‘brute force’ crush – rather than use one of a few common methods to crush the file, it will use all of them. It’ll take longer, especially on older hardware, but may result in a smaller PNG file.

And you’re done. Now, when you right-click on a PNG file, you can select ‘Crush’ and have Pngcrush your image for you. Remember that the compression is lossless – you won’t lose any quality by using the tool.

9 Comments

  1. Very handy! I also used to do this by hand, so this is a real time-saver. I also use PNGOut, which I find sometimes gives better results. I suppose you could set up two context-menu options, one “Crush with PNGCrush”, then other “Crush with PNGOut”, and compare the two outputted files.

  2. Thanks for that David, I never knew about PNGOut. I’m trying it now, although it does seem to be quite slow.

  3. A useful option to add to this is -fix
    I had one file that wouldn’t crush, and apparently it had some errors in it. When I modified the command to use -fix, it worked great :-)
    btw, thanks for the tip :-)

  4. Does it a/effect the quality much?

  5. Good tip, I actually had pngcrush extracted into the My Pictures folder. After installing the “Open CMD window here” powertoy, I basically just right clicked the “My Pictures” on my start menu and went from there. I’ll probably still do that but its nice to have it in the right click menu too ;)
    Ben: nope compression is lossless, you won’t lose any quality by using pngcrush.

  6. Nice! Let me try it.

  7. Don’t need this as I only tend to post with jpg’s instead. Incidentally are you aware of any way to use gravatar with multiple email address’s?

  8. Andy: Sure, but you need to donate some money to get an upgraded account. It’s only $5, I think.

  9. I installed the prog and have the right click option but where in gods green earth does the program save the new crushed png?
    Help please thank you:)