Skip to content

Instantly share code, notes, and snippets.

@saethlin
Created November 4, 2017 03:37
Show Gist options
  • Save saethlin/839c399908be574f3d7d283d9ec7223c to your computer and use it in GitHub Desktop.
Save saethlin/839c399908be574f3d7d283d9ec7223c to your computer and use it in GitHub Desktop.
import numpy as np
from scipy.misc import imsave
max_y = 0
max_x = 0
with open('Stego_3.txt') as f:
contents = f.readlines()
coordinates = []
for line in contents:
coords, color = line.split(':')
y, x = coords.split(',')
max_y = max(int(y), max_y)
max_x = max(int(x), max_x)
image = np.ndarray([max_x+1, max_y+1, 3])
for line in contents:
coords, color = line.split(':')
x, y = coords.split(',')
y = int(y)
x = int(x)
color = color.split()[0]
color = color[1:-1]
r, g, b = [int(x) for x in color.split(',')]
image[y, x, 0] = r
image[y, x, 1] = g
image[y, x, 2] = b
imsave('test.png', image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment