// A Badass PasteBin

// A Badass PasteBin

// Generate image puzzle
from PIL import Image
import random


def process(a):
	rang = list(range(0,len(a)))
	random.shuffle(rang)
	b = []
	for x in rang:
		b.append(a[x])
		key_lst.append(x)
	return b

# open source image, get pixels and size
filename = 'cat.jpg'
src_im = Image.open(filename)
src_list = list(src_im.getdata())
w, h = src_im.size

random_lst = []
key_lst = []

for i in src_list:
	random_lst.append(i)

# shuffle the pixel list, and save indexes for key.
random_lst = process(random_lst)

# create randomized image
random_im = Image.new('RGB', (w, h))
random_im.putdata(random_lst)
random_im.save('random_im.png')

# create key text file
key_str = ""
for k in key_lst:
	key_str += str(k) + "\n"

key_file = open("key_file.txt", "w")
key_file.write(key_str)
key_file.close()
ID: 6qk0
URL:
Expires: Never
Created: Tue, 18 Apr 2017 01:30:52 -0700
(7 months ago)

Share this Paste

Use the following URLs to access this Paste

You do know how to copy and paste, right?

×

Edit

×

Encrypt

×

Delete this Paste

Hit the delete button below to make this FN Paste disappear forever.

×
© Copyright 2017 fnPaste.com
// Web Hosting provided by Krellen