Mirror imaging binary numbers
Craig
craigtw.online at gmail.com
Wed Dec 6 21:23:03 EST 2006
Terry Reedy wrote:
> "Craig" <craigtw.online at gmail.com> wrote in message
> news:1165446077.584437.206310 at 73g2000cwn.googlegroups.com...
> > Thanks so much for the response. I have an array of individual bytes
> > which will eventually make up a binary bitmap image that is loaded onto
> > an LCD screen (1 = black dot, 0 = white dot). At the moment each byte
> > is reversed to what it should be (completely reverse the bit order):
> > e.g 00111101 should be 10111100, 11001100 should be 00110011, etc. It
> > is not an int problem as such, it is more a bit level swap if you get
> > what I mean. If you could help that would be great.
>
> Using any of the solutions posted by others, I would first make a 256 byte
> string in which each byte was the bit reversed version of its index.
>
> IE, bitrev = "\x00\x80\x40\xC0.....\xFF"
>
> Then your actual image processing is a simple, quick lookup for each byte.
>
> Terry Jan Reedy
Thanks for all your great help guys. They work great.
More information about the Python-list
mailing list