In a grayscale image, each pixel is typically stored as an 8‑bit number (0–255). Instead of looking at the full number, a bit plane isolates just across all pixels.
for bit in range(8): plane = (pixels >> bit) & 1 # isolate one bit plane_img = Image.fromarray(plane * 255) # 0→black, 1→white plane_img.save(f'bitplane_bit.png') bit planes unblocked
Look only at the leftmost bit of each byte. In a grayscale image, each pixel is typically
Row 1: 0, 1, 0, 0 → as an image row: black, white, black, black. In a grayscale image
In a grayscale image, each pixel is typically stored as an 8‑bit number (0–255). Instead of looking at the full number, a bit plane isolates just across all pixels.
for bit in range(8): plane = (pixels >> bit) & 1 # isolate one bit plane_img = Image.fromarray(plane * 255) # 0→black, 1→white plane_img.save(f'bitplane_bit.png')
Look only at the leftmost bit of each byte.
Row 1: 0, 1, 0, 0 → as an image row: black, white, black, black.