Skip to content

Instantly share code, notes, and snippets.

@antiface
antiface / spiral.py
Created August 6, 2016 14:00 — forked from adusak/spiral.py
Generates bitmap of a spiral
import math
from PIL import Image
def spiral(r=20):
im = Image.new("RGB", (r * 2, r * 2), (255, 255, 255))
inc = 10
inside = True
angle = 0
@antiface
antiface / polygon.py
Created August 6, 2016 13:59 — forked from adusak/polygon.py
Generates bitmap polygon from points
from PIL import Image
from python.common import line as ln
def polygon(points):
# first lets convert the points to lines
lines = []
xmax = 0
ymax = 0
#-*- coding: utf-8 -*-
def bitsort(inlist):
tmplist = list([0] * 100)
for item in inlist:
tmplist[item] = 1
outlist = [i for i, item in enumerate(tmplist) if item == 1]
return outlist