Exemple #1
0
 def curve(self, image, width=4, number=6, color=None):
     dx, height = image.size
     dx /= number
     path = [(dx * i, random.randint(0, height))
             for i in xrange(1, number)]
     bcoefs = self._bezier.make_bezier(number - 1)
     points = []
     for coefs in bcoefs:
         points.append(tuple(sum([coef * p for coef, p in zip(coefs, ps)])
                             for ps in zip(*path)))
     Draw(image).line(points, fill=color if color else self._color, width=width)
     return image
Exemple #2
0
 def noise(self, image, number=50, level=2, color=None):
     width, height = image.size
     dx = width / 10
     width -= dx
     dy = height / 10
     height -= dy
     draw = Draw(image)
     for i in xrange(number):
         x = int(random.uniform(dx, width))
         y = int(random.uniform(dy, height))
         draw.line(((x, y), (x + level, y)), fill=color if color else self._color, width=level)
     return image