Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- leftmost = 15 #Initial value
- for y in range(16): #Loop by rows
- count = 0 #Count keeps track of the pixel position
- pos = 128 * y + 40 #Offset to the start of a row
- for x in range(8): #Loop now by the column. This keeps track of bytes
- if data[pos] >> 4 > 0: #Checking the first pixel in the byte for non-zero value
- if leftmost > count: #Update leftmost (if appropriate)
- leftmost = count
- break
- count += 1 #Increment pixel counter
- if data[pos] & 15 > 0: #Checking the 2nd pixel in the byte for non-zero value
- if leftmost > count: #Update leftmost (if appropriate)
- leftmost = count
- break
- count += 1 #Increment pixel counter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement