Skip to content

Commit 48ca25e

Browse files
committed
updated
1 parent 96c799a commit 48ca25e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

image_encrypted.jpg

104 KB
Loading

image_encryption_decryption.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def open_img():
9090
def en_fun():
9191
global x, image_encrypted, key
9292
# print(x)
93-
image_input = imread(x, IMREAD_GRAYSCALE)# 'C:/Users/aakas/Documents/flower.jpg'
93+
image_input = cv2.imread(x, 0)# 'C:/Users/aakas/Documents/flower.jpg'
9494
(x1, y) = image_input.shape
9595
image_input = image_input.astype(float) / 255.0
9696
# print(image_input)
@@ -99,7 +99,7 @@ def en_fun():
9999
key = np.random.normal(mu, sigma, (x1, y)) + np.finfo(float).eps
100100
# print(key)
101101
image_encrypted = image_input / key
102-
imwrite('image_encrypted.jpg', image_encrypted * 255)
102+
cv2.imwrite('image_encrypted.jpg', image_encrypted * 255)
103103

104104
imge = Image.open('image_encrypted.jpg')
105105
imge = ImageTk.PhotoImage(imge)
@@ -112,7 +112,7 @@ def de_fun():
112112
global image_encrypted, key
113113
image_output = image_encrypted * key
114114
image_output *= 255.0
115-
imwrite('image_output.jpg', image_output)
115+
cv2.imwrite('image_output.jpg', image_output)
116116

117117
imgd = Image.open('image_output.jpg')
118118
imgd = ImageTk.PhotoImage(imgd)

image_output.jpg

26.2 KB
Loading

0 commit comments

Comments
 (0)