User:FluffyDunlop/Networked Prototyping/Raw Data
< User:FluffyDunlop | Networked Prototyping
Revision as of 17:58, 16 January 2014 by FluffyDunlop (talk | contribs)
_______ _______ _______ ______ _________ _______ _________ ______ _______ _______ ( ____ )( ___ )|\ /| ( ___ )|\ /|( __ \ \__ __/( ___ ) |\ /|\__ __/( __ \ ( ____ \( ___ ) | ( )|| ( ) || ) ( | | ( ) || ) ( || ( \ ) ) ( | ( ) | | ) ( | ) ( | ( \ )| ( \/| ( ) | | (____)|| (___) || | _ | | | (___) || | | || | ) | | | | | | | | | | | | | | | ) || (__ | | | | | __)| ___ || |( )| | | ___ || | | || | | | | | | | | | ( ( ) ) | | | | | || __) | | | | | (\ ( | ( ) || || || | | ( ) || | | || | ) | | | | | | | \ \_/ / | | | | ) || ( | | | | | ) \ \__| ) ( || () () | | ) ( || (___) || (__/ )___) (___| (___) | \ / ___) (___| (__/ )| (____/\| (___) | |/ \__/|/ \|(_______) |/ \|(_______)(______/ \_______/(_______) \_/ \_______/(______/ (_______/(_______)
import struct, array, random, math
width = 1920
height = 1080
N = 1
redcount = 0
count = 0
for y in range(5): #25 frames a sec
datafile = open('images/image%d.tga' %(N,), 'wb')
header = struct.pack("<BBBHHBHHHHBB", 0, 0, 2, 0, 0, 8, 0, 0, width, height, 32, 1 << 5)
datafile.write(header)
data = ''
screentime = ((width * height) / (random.randint(1,2)))
for x in xrange(width):
redcount = random.randint(0,255)
var = random.uniform(0,2)
for y in xrange (height):
r = redcount
g = 0
b = 0
a = 0
if count >= ((var * 90) * float(screentime)):
r = 0
g = redcount
if count >= ((var * 40) * float(screentime)):
g = 0
b = redcount
if count >= ((var * 80) * float(screentime)):
b = 0
a = redcount
if count >= ((var * 160) * float(screentime)):
count = 0
data += struct.pack('BBBB', b, g, r, a)
#print screentime
count = count + 1
print N
N = N + 1
datafile.write(data)
datafile.close()