I used addition and subtraction to encode and decode the image in Python but I could not do it by multiplication and division. Can anyone?
Encryption code section:
for i in range(image.shape[0]):
for j in range(image.shape[1]):
temp=image[i, j] + key[i,j]
if temp > 255:
temp = image[i, j] + key[i,j] - 255
result[i,j]=temp
Decryption code section :
for i in range(image.shape[0]):
for j in range(image.shape[1]):
temp = image[i, j]-key[i,j]
if temp < 0:
temp = 255 + temp
result[i, j] = temp