Download the following files:
They will provide a skeleton for your code. You may write whatever additional methods you feel are necessary to complete this lab, be sure to fully document your code. You should not have to change anything in Picture.java, only LSB.java.To decode a message from a picture, the command will be
java LSB image.png D
and to encode a message, the command will be
java LSB image.jpg E "My Message Here" image.png
You will need to add code to LSB.java in three places:
When encoding, the message must be translated into binary numbers. When decoding, you will need to translate binary numbers back into text.
Start with the first pixel in the upper-left corner, you will need to extract the message from the image. Each pixel should be examined in order of Red, Green, Blue. If the number is odd, record a 1, if the number is even, record a 0.
To encode a message, again start in the upper-left corner of the image. In each pixel, proceed through the colors in order Red, Green, Blue. If the value is odd for that color, but should be even according to the current binary digit, subtract 1. If the value is even for that color, but should be odd according to the current binary digit, add 1.
You must decode the following images, and write the encoded message in your lab1.txt file:
In addition, you must encode a message of your own, using an image of your choosing. Save the encoded image as "myimage.png".
ssh username@cs.centenary.edu
to connect with the cs server.
mkdir csc350
mkdir csc350/lab1
logout
scp filenames username@cs.centenary.edu:"csc350/lab1"