The sketch presents the user with a relatively large viewing window showing two images, initially identical, allows the user to (1) type in a brief message; (2) select a region in the modifiable image into which the message will be encoded; (3) then confirm the region selection by clicking inside the user-drawn rectangular region.
The message is encoded in the following way. The algorithm treats the user-supplied message as a String, working through the entire string character-by-character, and encoding each single character into/across the lowest bits of the RGB values of 3 pseudo-consecutive pixels in the modifiable image using a simple lowest-bits replacement scheme.
For example, the character “T” has int value 84 with 8-bit binary string code 01010100. The left-most digits of the binary string, 010, are encoded as the lowest bits in the RGB values of pixel 1, the next 3 bits 101 are endoded as the lowest bits in the RGB values of pixel 2, and the right-most 2 bits 00 are encoded as the lowest bits in the RG values of pixel 3 (leaving the B value of the 3rd pixel unchanged).
The pixels for each character encoding are “pseudo consecutive” because the algorithm works left-to-right, top-to-bottom through the pixels in the rectangular array specified by the user's mouse-dragging operation. Thus one character might use two pixels in one row and a 3rd pixel in another row instead of all pixels being continguous.
Below are two examples of the display window after the user manipulation of the message and image-encoding location (sadly, the user-accessible text box is not showing up in this captured images):
(Click any of the example images to go to the applet version and see the underlying Processing code.)