User:-Prototyping Networked-/-RAW-
< User:-Prototyping Networked-
Revision as of 10:38, 14 October 2013 by Luisa Moura (talk | contribs)
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import struct
f = open("image.data", 'w')
data = ''
for x in range(10000):
data += struct.pack('B', 255)
data += struct.pack('B', 0)
data += struct.pack('B', 0)
for x in range(20000):
data += struct.pack('B', 0)
data += struct.pack('B', 75)
data += struct.pack('B', 0)
for x in range(2000):
data += struct.pack('B', 50)
data += struct.pack('B', 50)
data += struct.pack('B', 25)
for x in range(50000):
data += struct.pack('B', 255)
data += struct.pack('B', 0)
data += struct.pack('B', 0)
f.write(data)
f.close()
experiments with Henk-Jelle
<source lang="python">
import struct
import random
f = open("image.data", 'w')
data =
for x in range(100000):
varR = random.randint(0,255)
varG = random.randint(0,255)
varB = random.randint(0,255)
data += struct.pack('B', varR)
data += struct.pack('B', varG)
data += struct.pack('B', varB)
f.write(data)
f.close()