- Route: /
- Displays the index page with options for encoding, decoding, and viewing the last encoded image or decoded message.
- Route: /404
- Displays a custom error page when a page is not found.
- Route: /image/last/encoded
- Displays the last encoded image, if available.
- Route: /image/last/decoded
- Displays the last decoded message, if available.
- Route: /encode
- Allows users to encode a message into a PNG image.
- Route: /decode
- Allows users to decode a message from a PNG image.
For the encoding process, I have converted the input message to binary, the input image to binary (it must be .PNG, otherwise it won't work) and encoded them according to the formula. I have added a stop string ("$#&") at the end, to know where to stop in the decoding process. Basically, the message + $#& is encoded in the pixels of the image, and when the message is fully traversed, then the pixel traversal is exited. The image is saved at path:"public/images/encoded_image.png" so that it can also be displayed at the path "image/last/encoded", but also for the last encoded image.
For the decoding process, I have converted the image back to binary and went pixel by pixel and did the reverse of the encoding. I also checked the stop string ("$#&"), so I know when to stop and not loop through the whole image for nothing. The received binary message is then converted to ASCII by evaluating chunks of 8 bits each. The final message is written to path:"public/message/message.txt" to be displayed in the last message decoded section and in the "image/last/decoded" path.
The docker image has the FLASK and PILLOW requirements. So, to create the docker image, you have to use this command:
docker build -t iap-tema2 .
and to start it, use this command:
docker run -p 8080:80 -it iap-tema2
It should be available Here