User:-Prototyping Networked-/-RAW-

From XPUB & Lens-Based wiki
< User:-Prototyping Networked-
Revision as of 17:17, 7 October 2013 by Luisa Moura (talk | contribs) (Created page with "#!/usr/bin/env python #-*- coding:utf-8 -*- <source lang="python"> import struct import random f = open("image.data", 'w') data = '' for x in range(10000): ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  1. !/usr/bin/env python
  1. -*- coding:utf-8 -*-

<source lang="python">

import struct

import random



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()