If you erase lower two bits in the red value, you can clear space for hiding values

Question:

If you erase lower two bits in the red value, you can clear space for hiding values 0–4.

for p in getPixels(picture):
 # Clear out the red 2xLSB
 r = getRed(p)
 setRed(p,r-(r%4))

If you erase the lower two bits from red, green, and blue, you can save six bits. Six bits can encode 64 values. That’s enough to encode all 27 letters, both upper and lowercase.

(a) Write a function to input a picture and a string. Save each character in the string in a pixel of the picture, by saving it across the least significant two bits in each of red, green, and blue. Can you tell the difference between the original picture and the picture with the encoded text message?

(b) Now write a function to decode the original text.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: