Add support for greyscale and highest order bit generation
BIN
garbage/(((((((x) * x) >> y) | y) - y) & 10) ** x) & 128.png
Normal file
After Width: | Height: | Size: 213 B |
BIN
garbage/(((((((x) << 4) ** x) ^ 5) << y) >> y) << 9) & 128.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
garbage/((((((x) ** 14) | x) - 5) + x) & y) & 1.png
Normal file
After Width: | Height: | Size: 661 B |
BIN
garbage/((((((x) | 12) << y) | 12) >> 3) ^ 7) & 128.png
Normal file
After Width: | Height: | Size: 256 B |
BIN
garbage/((((((y) ** 5) & y) >> x) >> 6) * x) & 1.png
Normal file
After Width: | Height: | Size: 813 B |
BIN
garbage/((((((y) - y) - y) | y) << x) ^ y) & 1.png
Normal file
After Width: | Height: | Size: 662 B |
BIN
garbage/(((((14) ** 16) | 9) + x) << x) & 1.png
Normal file
After Width: | Height: | Size: 594 B |
BIN
garbage/(((((4) + y) + x) * x) | x) & 1.png
Normal file
After Width: | Height: | Size: 595 B |
BIN
garbage/(((((7) - x) >> y) ** 14) * y) & 128.png
Normal file
After Width: | Height: | Size: 565 B |
BIN
garbage/(((((y) + x) << y) + 12) * 14) & 1.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
garbage/((((1) | 6) ** 11) | y) & 1.png
Normal file
After Width: | Height: | Size: 594 B |
BIN
garbage/((((6) ^ y) + y) ** y) & 128.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
garbage/((((x) & 15) & 7) ^ y) & 128.png
Normal file
After Width: | Height: | Size: 447 B |
BIN
garbage/((((y) * 7) ^ 3) + y) & 128.png
Normal file
After Width: | Height: | Size: 526 B |
BIN
garbage/(((5) | y) ^ 11) & 128.png
Normal file
After Width: | Height: | Size: 447 B |
57
generator.py
@ -1,10 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
import libpme, math, random, sys
|
||||
import pip._vendor.progress.bar as libbar
|
||||
img = libpme.PME()
|
||||
img.height = img.width = 1024
|
||||
img.color_type = libpme.color_types.GREYSCALE
|
||||
img.bit_depth = 1
|
||||
bitmask = 1
|
||||
greyscale = False
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1].lower() == "high":
|
||||
bitmask = 128
|
||||
elif sys.argv[1].lower() == "greyscale":
|
||||
greyscale = True
|
||||
bitmask = 255
|
||||
|
||||
operations = {
|
||||
"^": lambda x, y: x ^ y,
|
||||
@ -29,6 +33,7 @@ def gensym():
|
||||
return lambda x, y: x
|
||||
else:
|
||||
r = random.randint(1, 16)
|
||||
# we can't just write "return lambda x, y: random.randint(1, 16)" or it would generate a different random number for each pixel. That bug took forever to find
|
||||
return lambda x, y: r
|
||||
|
||||
|
||||
@ -52,34 +57,54 @@ def sbuilder(k, i = 0, recurse = False):
|
||||
return str(syms[i]("x", "y"))
|
||||
if recurse:
|
||||
return "(" + sbuilder(k[1:], i + 1, True) + ") " + k[0] + " " + str(syms[i]("x", "y"))
|
||||
return "(" + sbuilder(k, i, True) + ") & 1"
|
||||
return "(" + sbuilder(k, i, True) + ") & " + str(bitmask)
|
||||
|
||||
def mask(val):
|
||||
if greyscale:
|
||||
return min(255, max(0, val))
|
||||
if bitmask == 1:
|
||||
return val & bitmask
|
||||
else:
|
||||
return 0 if val & bitmask == 0 else 1
|
||||
|
||||
#print(ops)
|
||||
#the_function = lambda x, y: (((x^y)-y)*x >> 11) & 1
|
||||
#print(sbuilder(ops));
|
||||
the_function = lambda x, y: round(builder(ops)(x, y)) & 1
|
||||
print(sbuilder(ops));
|
||||
the_function = lambda x, y: mask(round(builder(ops)(x, y)))
|
||||
#print(the_function(2, 2))
|
||||
|
||||
# i = int(sys.argv[1])
|
||||
# badfiles = open("badfiles", "r").read().split("\n")[:-1]
|
||||
# the_function = eval("lambda x, y: " + badfiles[i].split("/")[-1].replace(" BAD FILENAME.png", ""))
|
||||
|
||||
|
||||
img = libpme.PME()
|
||||
img.height = img.width = 1024
|
||||
img.color_type = libpme.color_types.GREYSCALE
|
||||
img.bit_depth = 1
|
||||
|
||||
data = b''
|
||||
bar = libbar.IncrementalBar(max = img.height)
|
||||
bar.start()
|
||||
|
||||
if greyscale:
|
||||
img.bit_depth = 8
|
||||
|
||||
for y in range(1024):
|
||||
data += b'\x00'
|
||||
for x in range(0, 1024, 8):
|
||||
this_pixel = 0;
|
||||
for subx in range(8):
|
||||
this_x = x + subx
|
||||
val = the_function(this_x, y)
|
||||
this_pixel += val
|
||||
this_pixel <<= 1
|
||||
this_pixel >>= 1
|
||||
data += bytes([this_pixel])
|
||||
if not greyscale:
|
||||
for x in range(0, 1024, 8):
|
||||
this_pixel = 0;
|
||||
for subx in range(8):
|
||||
this_x = x + subx
|
||||
val = the_function(this_x, y)
|
||||
this_pixel += val
|
||||
this_pixel <<= 1
|
||||
this_pixel >>= 1
|
||||
data += bytes([this_pixel])
|
||||
else:
|
||||
for x in range(1024):
|
||||
data += bytes([the_function(x, y)])
|
||||
bar.index = y
|
||||
if y % 13 == 0: bar.update()
|
||||
|
||||
|
BIN
interesting/(((((((y) * y) * 5) ** x) + 7) - y) * x) & 128.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
interesting/(((((((y) | 10) - 4) | y) & 15) & y) ** x) & 255.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
interesting/(((6) ** 14) ÷? y) & 1.png
Normal file
After Width: | Height: | Size: 924 B |
BIN
interesting/(((x) | y) ÷? 3) & 1.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
interesting/(((y) * y) + y) & 128.png
Normal file
After Width: | Height: | Size: 936 B |
BIN
very small patterns/(((((x) * y) & 3) * y) & x) & 1.png
Normal file
After Width: | Height: | Size: 662 B |