Geenat.com Nathan’s blog about software development, design and the people behind it.

Why you should use PNG for web design, and how to do it properly!

Written on July 9th, 2009

PNG SamplePNG is a fantastic open source image format that has the technical potential to be the do-all end-all for graphics on the web. In theory, PNG has a sizable list of advantages for people designing websites, including:

  • Full color support.
  • Full alpha channel support. (In modern browsers above Internet Explorer 6)
  • Efficient lossless compression. (And by the end of this article, smaller than an equivalent GIF!)
  • Patent free and open source.

However, in practice one will notice that some web browsers have mixed support for certain features found in the PNG format (usually PNG’s built-in gamma and color correction aka color profiles. Which can inadvertently cause serious differences in shade and color when viewing the same PNG image on different browsers). These inconsistencies cause a huge headache for web designers who wish to use this format for images in their designs!

That said, in this article I will show you how to solve this issue so that your PNG images display flawlessly on all modern browsers! This method also has the welcome side effect of shrinking the PNG file size, making them smaller than an equivalent GIF, and sometimes even comparable to the size of a lossy JPEG!

This process of “PNG Optimization” is extremely easy when one has the right tools. Luckily enough, Windows, Mac and Linux users have a fantastic open source utility called pngcrush. Since it’s a command line tool, you can optimize a virtually limitless number of .png’s with a single command! Perfect for processing the “/image” directory of a website.

pngcrush -rem alla -d outputdir *.png

For those wondering, “-rem alla” stands for “remove all ancillary chunks”.

This command strips out all ICC color profiles, gamma profiles, and other unnecessary auxiliary data that is generally used in photography, but not needed in website design; effectively solving consistency problems between browsers. In addition, this extra data can use up a lot of space in the PNG image, and once it’s stripped out the size of the PNG will generally shrink down significantly.

pngcrush sample image

For Windows users, I’ve created a simple batch file that will run this command for you with a click of the mouse. Just remember to place the batch file, pngcrush.exe and the images to be optimized in the same directory before running it.

You can download the batch file, including the Windows excecutable of pngcrush from me directly, or get the latest version of pngcrush at Sourceforge.net

Enjoy! And I hope to see more usage of this great image format on the web.

Additional Resources:

TweakPNG – A utility for exploring the internals of a PNG file. For anyone who wants to see exactly what is inside of their PNG files. (http://entropymine.com/jason/tweakpng/)

Posted in Download, How To Guide, Open Source

Microsoft has been caught installing exploits into Firefox through Windows Update!

Written on June 9th, 2009

As part of their monthly set of security fixes to Windows, Microsoft has decided to make modifications to the Firefox web browser. The modification is an extension called Microsoft .NET Framework Assistant, featuring Microsoft’s “ClickOnce technology” which enables any website to easily and quietly install software onto the host computer.

Microsoft has literally modified Firefox without our knowledge or permission with the effect of adding a significant back door for malicious software creators.

Now the whole reason I use Firefox is because I do not want websites to have the ability to easily and quietly install software that could potentially mess up or take over my system. As mentioned in my previous post, this is the primary reason why I left Internet Explorer in the first place.

I personally think this is absolutely appalling and sheds even more light on Microsoft’s disgusting, anti-competitive business practices. These are the kinds of issues that the European Union have been fighting Microsoft about over the past few years, and continue to fight them about.

If your version of Windows is current, you’ll notice the new addition in Firefox under Tools, Add-Ons, Extensions.

Microsoft .NET Framework Firefox Extension

Making matters worse, the uninstallation process is far from simple. Microsoft has also disabled the uninstall button in Firefox, and the removal process is a painstaking set of instructions found on Microsoft’s support website.

The issue was first discovered by the Washington Post’s Computer Security columnist, Brian Krebs, in an article entitled “Microsoft Update Quietly Installs Firefox Extension“. I personally first heard the issue through Steve Gibson’s and Leo Laporte’s Security Now podcast, episode 199. Steve does a great job explaining the little details and has quite an in depth discussion with Leo on the subject. I recommend checking these resources out it out if you would like more details.

Posted in Firefox, Open Source, Security

Firefox 3 is now the number one web browser in Europe!

Written on May 24th, 2009

Firefox Vs IE.. om nom nomIf you didn’t know already, as of last month, Firefox 3 has become the most popular browser in Europe! I am personally overjoyed by this occurrence and wish the Mozilla Foundation the best and much continued success.

This is a huge triumph for not only website developers, but also open source software as a whole. Before the Mozilla Foundation came onto the scene and released Firefox, the world of web browsers was in a depressing state. I wouldn’t doubt the majority of people reading this blog remember the post-Netscape, pre-Firefox days. I was graduating from highschool at the time and remember this era clearly.

Microsoft enjoyed a functional monopoly on the web browser market with their own Internet Explorer 6. As a result of Microsoft’s monopoly, web standards were for the most part thrown out the window, introduction of closed-proprietary features and formats were common, computer infection rates were very high and spyware ran rampant. At this time I frequented computer gaming events (LAN Parties!) with a number of my buddies. I remember us sharing our experiences about how ourselves, our friends and family members were constantly infected with malicious software contracted through Microsoft’s web browser. It was common to do a complete re-install of ones operating system every few months in order to keep things running at an acceptable level.

Feels good man.

Then out of nowhere, Firefox was released into the market. I admit, even I was a little skeptical to try it at first, yet I do remember that first day.. My good friend Andrew Almond insisted I try out this fantastic and fresh new browser, insisting a huge improvement over Microsoft’s offering; after which I did.

Installing Firefox was a breath of fresh air as my own computer infection problems nearly disappeared overnight! After about a month, the adoption of this new web browser exploded, and the thought of using Internet Explorer over Firefox became nearly laughable to us. The good word spread like wildfire.

Fast forward to now, Firefox is in its third iteration and better than ever. Microsoft has since had to clean up their act as a result, and there are now a number of very good web browsers on the market to choose from including Opera, Apple’s Safari and Google’s Chrome. Competition is great, and the Internet is generally a much safer place than it used to be.

Firefox is still my favored web browser, and of course, it holds a special place in my heart as it once symbolized a bright light in a dark era on the web, and continues to symbolize itself as a model open source project. Thank you, Firefox!

Firefox eating IE icon by Archangel-Daemon!

Posted in Firefox, Open Source

Opensource Download: Creative Zen Support for Mac

Written on January 9th, 2009

My sister upgraded to a new Apple Mac mini the other day. She was disappointed that her Creative Zen V player did not work with it.

After a few minutes of research, we found that Creative does not supply any type of MacOS X download for their Zen MP3 players. Fortunately, the opensource community has their own solution to this: XNJB.

XNJB is a downloadable Mac application that supports transfering of music, recharging, and general management of many types of MP3 players that generally are not supported on the Mac platform. XNJB makes use of the fantastic opensource libnjb and libmtp libraries to make support for these MP3 players possible on many unofficially supported platforms including: Linux, BSD, Solaris, and of course, MacOS X and Windows.

To use your Creative Zen player on MacOS X, go directly to the XNJB application download page and download the Binary. You can find out more about XNJB at the official XNJB website.

Posted in Download, Open Source

HOW TO: Copy, backup and restore your Firefox bookmarks, settings and add-ons.

Written on December 7th, 2008

Firefox Logo

I formatted my workstation the other day and needed a way to transfer all of my Firefox bookmarks and settings. I stumbled upon a very simple and quick method through copying the Application Data folder. Interestingly enough, this method also has the welcome side-effect of transferring all of your add-ons as well; so things like DownThemAll and Firebug will all stay intact.

The folder you need to copy is: C:\Documents and Settings\USERNAME\Application Data\Mozilla\Firefox (in my case C:\Documents and Settings\Nathan\Application Data\Mozilla\Firefox).

The Application Data folder may be hidden on your system. To enable hidden system files do the following:

  1. From the explorer window, go to the “Tools” menu.
  2. Select “Folder Options…”
  3. Select the “View” tab.
  4. In the “Advanced Settings” area, enable “Show hidden files and folders”.
  5. Hit the Ok button.

The previously hidden Application Data folder should now be accessible.

Once you have this folder backed up, you can paste it into a Firefox Application Data folder on another system and have your entire user profile and customizations fully restored.

Note: This method has only been tested with Firefox 3 under Windows XP.

Posted in Firefox, How To Guide, Open Source