Monochrome Image Facts

Monochrome or Bilevel images contain only two colors, usually black and white.
A single bit is usually used to represent a pixel. This means a single byte can store 8 pixels. For this reason, two color images are the smallest whether compressed or uncompressed.

However there are particular differences when it comes to conventions about how the bits are stored and what they represent. Some like PBM use the value 1 to be black and 0 to be white. Others can do it either way. TIFF tag 262 determines this in a TIFF file. BMP files use a 2 color palette which allows either 0 or 1 to equal any color, not just black and white. Personally I think 0 should be used for black and 1 for white. It makes sense to me but this is also an arbitrary choice which format creators disagree on.

PBM and BMP use the high bit to be the leftmost pixel. Others like XBM and the raw monochrome data that Imagemagick reads use the low bit instead. There are two ways of going about this. One is to use either right shifting or left shifting as you place bits into a byte, the other is to simply use one method and then reverse the bits in a byte before writing it to the file. TIFF has tag 266 that determines the rule of which order they are in.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s