View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
simonc simonc is offline
external usenet poster
 
Posts: 52
Default Extracting individual bits from a byte


Thanks for this. It turns out And is the key.

To extract the eight bits of a byte I used

for i = 0 to 7
bit(i) = byte And 2^i
next

"EricG" wrote:

This might give you some hints:

http://support.microsoft.com/default.aspx/kb/113476

HTH,

Eric

"simonc" wrote:

i'm trying to get the data out of a monochrome bmp file which has one bit per
pixel. I can read the byte containing 8 consecutive pixels but I'm getting
tied in knots trying to find the most efficient way of reading the individual
bits into an array.

Grateful for advice