Rawimagegenerating: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "RAW IMAGE GENERATING PYTHON AND GIMP http://i.imgur.com/aPhlAqC.png import struct import random f = open("image.data", 'w') data = '' for x in range(100000): data +=...")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
PYTHON AND GIMP
PYTHON AND GIMP


http://i.imgur.com/aPhlAqC.png
[[File:A2.png]]
 
  import struct
  import struct
  import random
  import random
Line 8: Line 9:
  data = ''
  data = ''
  for x in range(100000):
  for x in range(100000):
     data += struct.pack('B', 74)
     data += struct.pack('B', 75)
     data += struct.pack('B', 115)
     data += struct.pack('B', 225)
       data += struct.pack('B', 185)
       data += struct.pack('B', 225)
  for x in range(203300):
  for x in range(203300):
       data += struct.pack('B', 0)
       data += struct.pack('B', 0)
         data += struct.pack('B', 212)
         data += struct.pack('B', 0)
         data += struct.pack('B', 225)
         data += struct.pack('B', 225)
  f.write(data)
  f.write(data)
Line 20: Line 21:


   
   
http://i.imgur.com/hRdCoKi.png
[[File:A1.png]]
  import struct
  import struct
  import random
  import random
Line 26: Line 27:
  data = ''
  data = ''
  for x in range(6460):
  for x in range(6460):
         data += struct.pack('B', 205)
         data += struct.pack('B', 225)
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
Line 35: Line 36:
  for x in range(260300):
  for x in range(260300):
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
         data += struct.pack('B', 238)
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
  f.write(data)
  f.write(data)
  f.close()
  f.close()


http://i.imgur.com/uYpktzU.png
[[File:UYpktzU.png]]
  import struct
  import struct
  import random
  import random
Line 55: Line 56:
  for x in range(2500):
  for x in range(2500):
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
         data += struct.pack('B', 238)
         data += struct.pack('B', 75)
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
  for x in range(25000):
  for x in range(25000):
         data += struct.pack('B', 50)
         data += struct.pack('B', 255)
         data += struct.pack('B', 50)
         data += struct.pack('B', 0)
         data += struct.pack('B', 25)
         data += struct.pack('B', 0)
   for x in range(50000):
   for x in range(50000):
         data += struct.pack('B', 75)
         data += struct.pack('B', 0)
         data += struct.pack('B', 255)
         data += struct.pack('B', 255)
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
Line 68: Line 69:
  f.close()
  f.close()


http://i.imgur.com/MGg8ddE.png
[[File:MGg8ddE.png]]
  import struct
  import struct
  import random
  import random
Line 83: Line 84:
   for x in range(52500):
   for x in range(52500):
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
         data += struct.pack('B', 238)
         data += struct.pack('B', 255)
         data += struct.pack('B', 0)
         data += struct.pack('B', 0)
  f.write(data)
  f.write(data)
Line 121: Line 122:
played also with Louisas code
played also with Louisas code


http://i.imgur.com/JulCv4q.png
[[File:JulCv4q.png]]
   
   
  import struct
  import struct

Latest revision as of 22:08, 4 December 2013

RAW IMAGE GENERATING PYTHON AND GIMP

A2.png

import struct
import random
f = open("image.data", 'w')
data = 
for x in range(100000):
   data += struct.pack('B', 75)
    data += struct.pack('B', 225)
     data += struct.pack('B', 225)
for x in range(203300):
     data += struct.pack('B', 0)
        data += struct.pack('B', 0)
        data += struct.pack('B', 225)
f.write(data)
f.close()


A1.png

import struct
import random
f = open("image.data", 'w')
data = 
for x in range(6460):
       data += struct.pack('B', 225)
       data += struct.pack('B', 0)
       data += struct.pack('B', 0)
for x in range(24300):
        data += struct.pack('B', 0)
        data += struct.pack('B', 0)
        data += struct.pack('B', 75)
for x in range(260300):
        data += struct.pack('B', 0)
        data += struct.pack('B', 0)
        data += struct.pack('B', 0)
f.write(data)
f.close()

UYpktzU.png

import struct
import random
f = open("image.data", 'w')
data = 
for x in range(15):
        data += struct.pack('B', 255)
        data += struct.pack('B', 0)
        data += struct.pack('B', 0)
for x in range(2300):
        data += struct.pack('B', 55)
        data += struct.pack('B', 0)
        data += struct.pack('B', 255)
for x in range(2500):
        data += struct.pack('B', 0)
        data += struct.pack('B', 75)
        data += struct.pack('B', 0)
for x in range(25000):
        data += struct.pack('B', 255)
        data += struct.pack('B', 0)
        data += struct.pack('B', 0)
 for x in range(50000):
        data += struct.pack('B', 0)
        data += struct.pack('B', 255)
        data += struct.pack('B', 0)
f.write(data)
f.close()

MGg8ddE.png

import struct
import random
 f = open("image.data", 'w')
data = 
for x in range(1515):
        data += struct.pack('B', 255)
        data += struct.pack('B', 55)
        data += struct.pack('B', 55)
for x in range(200):
        data += struct.pack('B', 55)
        data += struct.pack('B', 0)
        data += struct.pack('B', 255)
 for x in range(52500):
        data += struct.pack('B', 0)
        data += struct.pack('B', 255)
        data += struct.pack('B', 0)
f.write(data)
f.close()

Qrolsj0.jpg

import struct, array
width = 1320
height = 1240
filename="output.tga"
datafile = open(filename, "wb")
# TGA format: http://gpwiki.org/index.php/TGA
# Offset, ColorType, ImageType, PaletteStart, PaletteLen, PalBits, XOrigin, YOrigin, Width, Height, BPP, Orientation
header = struct.pack("<BBBHHBHHHHBB", 0, 0, 2, 0, 0, 8, 0, 0, width, height, 24, 1 << 5)
datafile.write(header)
data = 
for y in xrange(height):
   for x in xrange(width):
       r, g, b, e = 0, 0, 0, 0
        if y < 32:
           r = 75
        if x > 64 and x < 256:
           g = 55
        if y > 120:
           r = 128
        if e > 120:
     e = 255
       data += struct.pack('B', b)
       data += struct.pack('B', g)
       data += struct.pack('B', r)
datafile.write(data)
datafile.close()


played also with Louisas code

JulCv4q.png

import struct
import random
f = open("image.data", 'w')
data = 
for x in range(70000):
	varR = random.randint(0,55) 
	varG = random.randint(0,139) 
	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()

JGTJogI.png

import struct
import random
f = open("image.data", 'w')
data = 
for x in range(25550):
	varR = random.randint(0,55) 
	varG = random.randint(0,255) 
	varB = random.randint(0,25) 	
	data += struct.pack('B', varR) 
	data += struct.pack('B', varG)
        data += struct.pack('B', varB)
f.write(data)
      f.close()