Close

Rendering

A project log for 32 Shades of Grey

Portable NTSC test pattern generator

danjovicdanjovic 05/02/2018 at 14:250 Comments

Just created a Python script to render the image as it should appear on TV screen. 

# Project: 32 SOG
from PIL import Image

pixelclocks = 837

img = Image.new( 'RGB', (pixelclocks,pixelclocks*3/4), "black") # create a new black image
pixels = img.load() # create the pixel map

for y in range(img.size[1]/2):    # for every line
    x=0
    g=8
    for stripe in range(31):    # For every stripe
        for xx in range (27):
            pixels[x+xx,y]=(g,g,g)
        g=g+8
        x=x+27

for y in range(1+img.size[1]/2):    # for every line
    x=0
    g=256
    for stripe in range(31):    # For every stripe
        for xx in range (27):
            pixels[x+xx,y+img.size[1]/2]=(g,g,g)
        g=g-8
        x=x+27

img.show()

 Which resulted in the following image

Noticed the height of the image was proportionally enlarged to fit in 3:4 format as it takes 400 lines on the screen.

Discussions