from PIL import Image, ImageDraw # Create a test image with gray lines img = Image.new('L', (100, 100), color=255) d = ImageDraw.Draw(img) d.line([10, 10, 90, 90], fill=128, width=2) # Gray line d.line([10, 90, 90, 10], fill=0, width=2) # Black line # Convert with default dithering img1 = img.convert('1') zeros1 = 0 for y in range(100): for x in range(100): if img1.getpixel((x, y)) == 0: zeros1 += 1 print(f"Default dither zeros: {zeros1}") # Convert with NO dithering (Threshold) # Note: convert('1', dither=Image.Dither.NONE) might still do dithering in some versions? # The reliable way to threshold is point operation or custom threshold. # But let's check convert('1', dither=0) img2 = img.convert('1', dither=Image.Dither.NONE) zeros2 = 0 for y in range(100): for x in range(100): if img2.getpixel((x, y)) == 0: zeros2 += 1 print(f"No dither zeros: {zeros2}")