title: How does Google's Page Speed lossless image compression work?
body: <p>When you run Google's PageSpeed plugin for Firebug/Firefox on a website it will suggest cases where an image can be losslessly compressed, and provide a link to download this smaller image.</p>
  
  <p>For example:</p>
  
  <ul>
  <li>Losslessly compressing <a href="http://farm3.static.flickr.com/2667/4096993475_80359a672b_s.jpg">http://farm3.static.flickr.com/2667/4096993475_80359a672b_s.jpg</a> could save 33.5KiB (85% reduction).</li>
  <li>Losslessly compressing <a href="http://farm2.static.flickr.com/1149/5137875594_28d0e287fb_s.jpg">http://farm2.static.flickr.com/1149/5137875594_28d0e287fb_s.jpg</a> could save 18.5KiB (77% reduction).</li>
  <li>Losslessly compressing <a href="http://cdn.uservoice.com/images/widgets/en/feedback_tab_white.png">http://cdn.uservoice.com/images/widgets/en/feedback_tab_white.png</a> could save 262B (11% reduction).</li>
  <li>Losslessly compressing <a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/images/ui-bg_flat_75_ffffff_40x100.png">http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/images/ui-bg_flat_75_ffffff_40x100.png</a> could save 91B (51% reduction).</li>
  <li>Losslessly compressing <a href="http://www.gravatar.com/avatar/0b1bccebcd4c3c38cb5be805df5e4d42?s=45&amp;d=mm">http://www.gravatar.com/avatar/0b1bccebcd4c3c38cb5be805df5e4d42?s=45&amp;d=mm</a> could save 61B (5% reduction).</li>
  </ul>
  
  <p>This applies across both JPG and PNG filetypes (I haven't tested GIF or others.)</p>
  
  <p>Note too the Flickr thumbnails (all those images are 75x75 pixels.)  They're some pretty big savings.  If this is really so great, why aren't Yahoo applying this server-side to their entire library and reducing their storage and bandwidth loads?</p>
  
  <p>Even Stackoverflow.com stands for some very minor savings:</p>
  
  <ul>
  <li>Losslessly compressing <a href="http://sstatic.net/stackoverflow/img/sprites.png?v=3">http://sstatic.net/stackoverflow/img/sprites.png?v=3</a> could save 1.7KiB (10% reduction).</li>
  <li>Losslessly compressing <a href="http://sstatic.net/stackoverflow/img/tag-chrome.png">http://sstatic.net/stackoverflow/img/tag-chrome.png</a> could save 11B (1% reduction).</li>
  </ul>
  
  <p>I've seen PageSpeed suggest pretty decent savings on PNG files that I created using Photoshop's 'Save for Web' feature.</p>
  
  <p>So my question is, what changes are they making to the images to reduce them by so much?  I'm guessing there are different answers for different filetypes.  Is this really lossless for JPGs?  And how can they beat Photoshop?  Should I be a little suspicious of this?</p>