Tuesday, August 17, 2004

 
Hmm, I've been playing on Blograffiti, and discovering that A. There's not a hope in hell of finding my entry that predates me having a blog. B. That my newer entries don't work because it can only cope with so many marks. C. That there's someone called Dave who likes writing his name a lot. D. There's someone else who is trying to do the same, but hasn't figured that you need to be quick and put the last letter first. Either that or they've got a very odd name.

A picture, that needs to be seen not describedThe B is the important one, as one of them was of the picture on the right. Which doesn't work as well when half the dots are missing. Admittedly I got the black and white sections mixed up, but it still worked in the preview image.

But enough of this headache inducing image (which I originally saw when one of my friends forwarded it the morning after the night before, describing it as a "hangover cure". Fortunately I was about the only person who wasn't hungover. The others were less happy).

And there must be something wrong with my eyes, as half the illusions on that site don't seem to work (the ones that use colour seem less effective). Though rediscovering my blindspot is always fun (Under Various. Trying to use the diagram the wrong way round, so the vanishing bit is in the middle of the cross, can get confusing).

Whilst playing round with all this, I happened upon this site, which is quite useful for explaining various scanner related topics. I say that, if only because it's finally made me twig how all the FF, 255, and 8 and 24 bit stuff is related. Spot who never quite got the hang of hex.

BTW, in case you too have never figured it out:
A bit is a single character in binary. Binary is a counting system that uses 1 and 0. So 11 in binary is 3 in decimal (see this great site for how binary works - it took me long enough to figure out the scale is logarithmic, so that 111 in binary is 1 x 2^2 + 1 x 2^1 + 1 x 2^0 = 4 + 2 + 1 = 7). To write 3 in binary takes 2 bits or two characters. But as each new bit added corresponds to 2 to the power of n - 1, where need is the number over from the right (so the first figure in 111 in binary is the third from the right, n = 3, so n-1 = 2, so 100 must represent 2 to the power of 2, or 2 squared, which is 4, so one adds 4 on to the total), then each new bit exponentially increases the possible value of the figure.

So if there are 8 bits, then the maximum number they can represent is the sum of 2^n-1 where n is every integer from 0 to 7. Which is 255. So a sequence of 8 bits can represent any number in a 256 number range (they can also represent zero, by having 8 zeros. I'm not sure if computers write 00000000 for zero, or 00000001 for one, or if they simply use no entry for zero and 1 for one. But I think designing a programme to cope with such an erratic series would be too hard [how would it know when to spilt the values in a chain of data?], and it would be easier to use more memory to enter 8 digits for every figure up to 255).

Anyway, I'm digressing. A bit is a binary unit. You've got that? And 8 bits can encode 256 values.

When applied to a scanner, line art and halftone scanning produces back and white images where the options for each unit are on or off, which is black or white. Line art makes a dividing line through the range of input shades, and anything darker is black, and anything lighter is white. Which renders most images dismally. Halftone uses the inaccuracies of our eye to create regions of blurring which create the impression of shades in-between black and white. Like newspaper printing, or old versions of graphics programmes where everything descends into a mess of dots and crosses. Sometimes using Safe Mode in Windows can achieve the same effect (unintentionally). Dropping down the number of colours displayed by your computer might do the same, but it might also make this page unreadable (I haven't checked if it's luddite safe).

Like the illusions featured on that Wyrm place above, it uses patterns around and object to adapt how we see an object. It is not a faithful representation of the input data, but mere impressionism. Line art and halftone only take 1 bit to encode each display unit.

The next level of clarity is grayscale, where each part of the image is assigned a value between 0 and 255 (black and white). As the name suggests, it's a range of greys. Greyscale images require 8 bits of code for each display unit.

Colour images apply this same scale to red, green and blue (the primary colours light can be divided into, and the colours a colour monitor displays. Monitors and televisions rely on our inability to discern detail at the pixel level. If you look closely you'll see lines containing red, green and blue dots). So each display unit in an image contains a value for red, a value for green, and one for blue. Each of these values is between 0 and 255. As there are 3 sets of values, each encoded in 8 bits, the total number of bits for each display unit is 24.

And just to confuse me more, this monitor claims it's on 32 bits. So it's got an extra 8 bits encoding something. It might be greyscale, but I thought that could be achieved through using the 24 bit system, by making the values of red, green and blue equal.

Handily for people who wish to encode their own values, 24 bit data can be encoded in 6 characters, thanks to hexadecimal. Hexadecimal [or hexidemical as 72 other people think it is] is another system that runs from 0 1 2 3 4 5 6 7 8 9 A B C D E F.
So 10 in hex is 1 x 16 in decimal. Each digit added on to the right represents 16^n-1 (and so is 16 times as big as the next column to the left), so 100 in hexadecimal is 1x16^2 + 0x16^1 + 0x16^0 = 256 + 0 + 0. Therefore using just two digits in hexadecimal can encode the maximum value of 8 bits. So 3 sets of 2 digits can equal 24 bits of data. So ff,a1,00 represents 11111111,10100001,00000000.

HTML has been set up to use this feature, allowing 2 hexadecimal digits per primary colour. So the normal code works on a pattern of RRGGBB, where R is red, G green, and B is blue. So ffa100 comes out as this lovely colour.

And Blogger seems to prefer [span] to [font] as a command, but then this preview page has always acted oddly. And I really should have picked a colour that doesn’t blend so well with the rest of this page. But as I made it up on the spot...

So yes, I've finally got all that figured out, even if you're all confused as hell now.

Still don't know why there's 32 bits on this monitor (I tried the 24 bit setting, and it didn't seem any different).

Anyhoo,

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?