MCPcopy Create free account
hub / github.com/AdarshAddee/Hacktoberfest2022_for_Beginers / encodeText

Function encodeText

Python/Steganography.py:84–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82
83# defining function to encode data into Image
84def encodeText():
85 img_name = input("Enter image name (with extension): ")
86 # reading the input image using OpenCV-Python
87 img = cv2.imread(img_name)
88
89 # printing the details of the image
90 print("The shape of the image is: ", img.shape) # checking the image shape to calculate the number of bytes in it
91 print("The original image is as shown below: ")
92 # resizing the image as per the need
93 resizedImg = cv2.resize(img, (500, 500))
94 # displaying the image
95 cv2_imshow(resizedImg)
96
97 data = input("Enter data to be encoded: ")
98 if (len(data) == 0):
99 raise ValueError('Data is Empty')
100
101 file_name = input("Enter the name of the new encoded image (with extension): ")
102 # calling the hide_data() function to hide the secret message into the selected image
103 encodedImage = hide_data(img, data)
104 cv2.imwrite(file_name, encodedImage)
105
106# defining the function to decode the data in the image
107def decodeText():

Callers 1

steganographyFunction · 0.85

Calls 1

hide_dataFunction · 0.85

Tested by

no test coverage detected