Skip to content

Commit 48e05a4

Browse files
committed
XOR Pixel Values
1 parent 6c344bb commit 48e05a4

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

Steganography/scrambled1.png

193 KB
Loading

Steganography/scrambled2.png

193 KB
Loading

Steganography/xor_images.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/python
2+
3+
from PIL import Image
4+
5+
scrambled1 = Image.open('scrambled1.png')
6+
scrambled2 = Image.open('scrambled2.png')
7+
size = width, height = scrambled1.size
8+
9+
new = Image.new('RGB', size)
10+
11+
scrambled1 = scrambled1.load()
12+
scrambled2 = scrambled2.load()
13+
data = new.load()
14+
15+
for x in range(width):
16+
for y in range(height):
17+
18+
one = scrambled1[x,y]
19+
two = scrambled2[x,y]
20+
21+
new_color = (one[0] ^ two[0],
22+
one[1] ^ two[1],
23+
one[2] ^ two[2])
24+
25+
data[x,y] = new_color
26+
27+
new.save('result.jpg')
28+
new.show()
29+
30+
#Comparing two images using XOR pixel values of 2 images to create a new image that combines visual information from 2 image source

0 commit comments

Comments
 (0)