Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-*- coding: utf-8 -*-
- #!python
- import sys
- import codecs
- import io
- from PIL import Image, ImageFont, ImageDraw
- import string
- digs = []
- w = 1000
- h = w
- background = (255, 255, 255)
- image = Image.new("RGBA", (w, h), background)
- pixels = image.load()
- def int2base(x, base):
- digits = []
- while x:
- digits.append(int(x % base))
- x = int(x / base)
- digits.reverse()
- return digits
- def is_base_zeroes_ones_only(i, j):
- if i in [0, 1]:
- return True
- s = int2base(i, j)
- #print(s)
- for c in s:
- if(c != 0 and c!= 1):
- return False
- return True
- for i in range(0, w):
- for j in range(2, h):
- if(is_base_zeroes_ones_only(i, j)):
- pixels[i, j] = (0, 0, 0, 255)
- image.save("image.png")
Add Comment
Please, Sign In to add comment