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.
Step by Step Answer:
Introduction To Computing And Programming In Python A Multimedia Approach
ISBN: 9780134025544
4th Edition
Authors: Mark J. Guzdial, Barbara Ericson