Which Common Image Format Has The Smallest Pixel?

The digital equivalent of the question “How long is a piece of string?” could be “How big is a pixel?” The naive answer is “four bytes” — one for each colour channel (RGB) and alpha — but depending on the file format, a pixel could be much bigger, ranging from a few to hundreds of bytes.

Cloudinary’s Jon Sneyers decided to dive into the rabbit hole of graphics encoding, pitting various popular (and esoteric) image formats against one another in the quest to find the “smallest” pixel.

Perhaps not the most useful quandary to solve, but it is an interesting topic nonetheless. As Sneyers explains, there’s more to a PNG or JPEG than the raw pixel data:

However, actual image formats tend to have a “header” that contains quite a bit more information … Besides headers, image formats may have other kinds of “overhead”. They may contain all kinds of markers and checksums, intended to make the format more robust in case of transmission errors or other forms of corruption. Also, sometimes some kind of padding is required, to ensure that the data gets aligned properly.

Take JPEG, for example. Sneyers found a single-pixel JPEG is 141 bytes — far in excess of three or four bytes. As expected, the majority of the file is taken up by header and encoding information. This isn’t as surprising as you might expect:

One-pixel images are in a sense the worst-case scenario for image compression: they’re all headers and overhead, and very little data. And the very little data there is cannot really be compressed because compression depends on predictability, and how are you supposed to predict one single pixel?

So, which format came out with the smallest file size? The uncompressed PBM (Netpbm) format. One pixel is a mere eight bytes. Of course, that’s for an image consisting of just black and white and for any image worth transmitting, it quickly loses to the likes of compressed alternatives.

The best single-pixel format that’s supported by web browsers and common editing tools, is the venerable GIF. A white pixel with no alpha weighs in at 35 bytes, with the equivalent PNG being 67 bytes. Even with transparency, GIF wins out again at 43 versus 68, but PNG’s alpha is far superior to GIF’s single-colour binary offering.

Even so, best not to give GIFs a reason to hang around longer than they already have.

One pixel is worth three thousand words [Cloudinary, via Reddit]

The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.