Using PageSpeed/PngOut to Compress JPG/PNG with mouse clicks
Nobody cares to compress raster image like jpg before sending over the email, as it’s widely known that those raster images are well compressed and can’t be compressed any further by any file compress utility even using the powerful 7zip. It’s true that file compress utilities can’t do any good to raster images but simply adding unnecessary steps for email recipient to un-compress before viewing, or worse, making the file size even bigger.
However, there are utilities that specially designed to compress raster images. First is pngout.exe for png format and second is pagespeed_optimize_image.exe for jpg format. Its download rate is surprisingly low after uploaded since Apr 21, 2010, only 770 downloads as of time of writing at Jun 14, 2011. Yes, not many people know that jpg file can be further compressed, at least slightly. The good news is they both are free, but the bad news is they both are command line utilities that require lots of key strokes to make it work. And the filename for
pagespeed_optimize_image.exe itself seems need to be optimized? Anyway this article will show the way to integrate Windows Context Menu so compressing these images is a just a matter of right click away.
Context Menu for Image Compression
Associating a command for right click’s ‘Context Menu’ with certain file type can be done via Windows File Explorer, click on “Tools” and browse for “Folder Options …” then you will get the “Folder Options” popup. Click on File Types tab. Then associate the targeted file type with desired action. The steps are illustrated in this Command line association except that we are going to associate the action with image compression utility. For now we shall download
pagespeed_optimize_image.exe and store both of them into “My Picture” folder before we proceed further.
Page Speed Image Optimizer
Google Page Speed documentation implies that the optimization uses loss-less compression technique(s), although we could not point out the quality difference between before and after compression, but we need to alert user that it will definitely remove image meta data like IPTC or EXIF info. So be careful before performing any batch operation if you want to keep the camera information intack.
Continue from “Folder Options” pop up, clicking on “File types” tab, browse for
*.JPG file type and click on “Advanced” button shall lead to another “Edit File Type” small pop up. We can see that by default there are two actions associated to it, namely “Open” and “PrintTo”. We are going to add one “New” action calls “Optimize”.
Click on “New” will invoke another small pop up which allows user to enter the Action name for display at Context Menu. And also the command line that shall execute upon action. Enter “Optimize” into Action field and copy and paste the following command line into the “Application…” field:
"C:\Documents and Settings\Administrator\My Documents\My Pictures\pagespeed_optimize_image.exe" "%1" "%1"
Since PNG format is a loss-less format, so optimizing the file format also must conform to this principle. And
PNGOUT can do this work very well, although it takes a little longer to compress since it needs to try out all possible strategies in compressing the targeted png file.
We just need to repeat the whole steps like above after browsing for PNG file type, and enter the following command line into the “Application…” field:
"C:\Documents and Settings\Administrator\My Documents\My Pictures\pngout.exe" "%1"
The result is a pretty friendly working environment, you may now right click on either JPG or PNG files to optimize the images, or even highlight a few of them before clicking optimize to perform batch operation… What?!! you can’t find the File Types tab? and you are Vista or Seven user? hmm… Microsoft wasn’t too kind to you, but you are lucky today as you can download this free utility that requires no installation that can do the file type association job like above.
And what if you need to keep the original copy? you can create another extra action call “Optimize As”, where the command line for Page Speed is:
"C:\Documents and Settings\Administrator\My Documents\My Pictures\pagespeed_optimize_image.exe" "%1" "%1.min.jpg"
and the command line for PNGOUT is:
"C:\Documents and Settings\Administrator\My Documents\My Pictures\pngout.exe" "%1" "%1.min.png"
The output filename is a little cumbersome but it does the work. Last tips: you can do a triple click on the command line to highlight them for copying. Let us know by posting a reply if you have more requirements or tips.