from PIL import Image, ImageDraw

import random

W = 500
im = Image.new('RGB', (W, W))
NCOLORS = 19
NLINES = 15

def make_line_mask(im):
  mask = Image.new('L', im.size, color=0)

  grays = []
  v = 255.0
  for i in range(NCOLORS):
    grays.append(int(v))
    v *= 0.91
  grays.reverse()

  draw=ImageDraw.Draw(mask)
  y = im.size[1]/2
  for i in range(NCOLORS):
    draw.line((0,y, im.size[0], y), fill=grays[i], width=NCOLORS-i)
  
  mask.save('mask.png')
  return mask


def make_master_line():
  '''Make an image with alpha to be pasted for all lines'''
  im = Image.new('RGB', (W, W), color=(0, 255, 0))
  mask = make_line_mask(im)
  im.putalpha(mask)
  im.save('mline.png')
  return im

def add_line(im0, im1):
  x = random.randint(-W/2, W/2)
  y = random.randint(-W/2, W/2)
  r1 = im1.rotate(random.randint(5, 145))
  im0.paste(r1, (x, y), r1)

def make_image():
  im = Image.new('RGB', (W, W), color=(0, 0, 0))
  ml = make_master_line()
  for i in range(NLINES):
    add_line(im, ml)
  im.save('f.png')

make_image()

Add better glowing line script; uses alpha to create the line out of solid green; handles intersections well
Add better glowing line script; uses alpha to create the line out of solid green; handles intersections well
