Code Golf: 1x1 black pixel

Posted by Joey Adams on Stack Overflow See other posts from Stack Overflow or by Joey Adams
Published on 2010-05-29T00:23:02Z Indexed on 2010/05/29 0:32 UTC
Read the original article Hit count: 720

Recently, I used my favorite image editor to make a 1x1 black pixel (which can come in handy when you want to draw solid boxes in HTML cheaply). Even though I made it a monochrome PNG, it came out to be 120 bytes! I mean, that's kind of steep. 120 bytes. For one pixel. I then converted it to a GIF, which dropped the size down to 43 bytes. Much better, but still...

Challenge

The shortest image file or program that is or generates a 1x1 black pixel. A submission may be:

  • An image file that represents a 1x1 black pixel. The format chosen must be able to represent larger images than 1x1, and cannot be ad-hoc (that is, it can't be an image format you just made up for code golf). Image files will be ranked by byte count.
  • A program that generates such an image file. Programs will be ranked by character count, as usual in code golf.

As long as an answer falls into one of these two categories, anything is fair game.

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about fun