Skip to content

A fun project I did that encodes a string or text file in an image

Notifications You must be signed in to change notification settings

khevamann/text-embed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Encoder

I created this project, because I was learning about PPM files and how they store each pixel value in an array. I thought it would be cool to alter a file to hide information in a picture. This is a clever way to communicate secretly online. Since this program has a unique way of running, the only way to decode the image is to run it through the same program that encoded it.

Planned Features

  • Allow for multiple file formats (PNG, JPEG...)
  • Allow custom offsets to make the encoding more secure

Getting started

git clone https://github.com/khevamann/text-embed.git
cd text-embed

# To encode a file
python3 embed_string.py <image> <string or text_file>

# To decode a file
python3 embed_string.py <image>

Here is a sample run

Running the below script will encode the text file sample.txt into the image sample.ppm. The images below show the before and after. As you can see it is hard to notice the encoded string.

python3 embed_string.py sample.ppm sample.txt
Without String With String Encoded
Input Image Output Image

If you zoom in really close on the right image you can see the pixels that are altered with text. You will see some pixels that are clearly not the right color. However this is very hard to notice if not looking for it. To make it even more discrete you can use a larger image.

About

A fun project I did that encodes a string or text file in an image

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages