Scott Hanselman

Adding PNGOUT to the Explorer Right Click Context Menu

April 11, 2007 Comment on this post [6] Posted in Musings | PowerShell | Programming
Sponsored By

I've been creating more PNGs lately on the blog. However, the default PNGs created by most tools are fat fat fat. PNGOUT to the rescue.

So, now I use PNGOUT to compress all PNGs before they are uploaded to the blog now. It's wonderful. It looks like Rick "Paint.NET Guy" Brewster is also enamored with PNGOUT and is considering integrating support directly into PAINT.NET although there might be legal issues. I'd be happy with a simple "call PNGOUT when you're done" option. Poof, we've avoided any legal trouble.

I know there's lots of Windows Apps that front PNGOUT and other PNG apps, but I like my things integrated and automatic.

Thoughts:

  • I wonder if someone could write a Windows Live Writer Plugin to run PNG out on files created by WLW before they are posted?
  • Since I'm using Kenny Kerr's Window Clippings to create the PNGs, it'd be more expedient to ask him to add the "Call PNGOUT when you're done"-feature to his tool.
  • I think I'll just integrate PNGOUT with the shell, it'll be faster...

Create PNGOUT.reg file that looks like this:

Windows Registry Editor Version 5.00 
[HKEY_CLASSES_ROOT\pngfile\shell\PNGOUT]
[HKEY_CLASSES_ROOT\pngfile\shell\PNGOUT\command]
@="\"C:\\Utils\\pngout.exe\" \"%1\""

Make sure you change your path to PNGOUT to match reality. Now you have this available in Explorer:

Optimizing all existing PNGs on my blog

Ah, but I also need to tidy up the EXISTING PNGs from my site. First I'll download all the PNGs to my local drive, then fire up PowerShell and run this command that will recurse everywhere in the current directory and below and run PNGOUT on all the PNGs, replacing them in place:

get-childitem . -include *.png -recurse | foreach ($_) { pngout "$_"}

Uploaded, and now I've taken my total PNG size (of all PNGs in all posts on the blog) from 40,004,166 bytes to 23,004,247 bytes a savings of about 42%. That'll add up in bandwidth costs.

You can also optimize the autogenerated PNG files within Windows Live Writer by running that same PowerShell command on the files in

%APPDATA%\Windows Live Writer\PostSupportingFilesWriter\PostSupportingFiles

It's a shame that most default libraries for PNG make such large PNGs, considering that this is the "picture format design for the web." Thanks PNGOUT!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
April 11, 2007 23:44
And yes, I know it's ironic that the DOS Screenshot there is a JPEG. Thanks. :)
April 12, 2007 0:18
Cool! An ideal companion to PureJPEG ?

http://www.yafla.com/papers/purejpeg/filter_unnecessary_jpeg_info_such_as_exif.htm
April 12, 2007 9:08
Your wish is my command. :)

http://weblogs.asp.net/kennykerr/archive/2007/04/12/looking-forward-to-window-clippings-2-0-storage.aspx
April 13, 2007 8:48
Does the term "hanselmintues" apply to the word "soon"? As in, Mr. Hanselman emailed me 5-6 weeks ago and said his 5000-word doc on Powershell deployment, et.al would be published "soon". Hansel-soon? :)
April 13, 2007 21:11
PNGOUTWin supports this as well.

http://www.ardfry.com/pngoutwin/FAQ.htm
April 17, 2007 4:17
> It's a shame that most default libraries for PNG make such large PNGs

It's probably because most apps output PNGs with interlacing, which is a giant waste of time. Interlacing *alone* increases PNG file size substantially-- interlaced PNGs are 25-40% larger than non-interlaced PNGs.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.