Skip to content
Image steganography demo
C++ Makefile
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Encode entire binary files into an image Jun 6, 2015
Makefile Encode entire binary files into an image Jun 6, 2015
README.md Add instructions for MacOS with Homebrew Feb 15, 2018
decode-file.cpp Row-major storage for encode-file/decode-file Jun 14, 2015
decode.cpp Compensate for newer ImageMagick libs built w/QuantumDepth==16. Feb 28, 2011
encode-file.cpp
encode.cpp Compensate for newer ImageMagick libs built w/QuantumDepth==16. Feb 28, 2011
sample1.png include sample images Feb 5, 2010
sample2.png
shifty.cpp Compensate for newer ImageMagick libs built w/QuantumDepth==16. Feb 28, 2011
spy.cpp Leading 0 in hex Jun 14, 2015
tweaky.cpp Add a program to tweak lowest N bits Jun 5, 2015

README.md

Image steganography

These are C++ programs to hide and reveal data kept in low-order bits of lossless image files. See the video at https://www.youtube.com/watch?v=-7FBPgQDX5o

Building

Building them requires a C++ compiler and the GraphicsMagick library. (GraphicsMagick is a variant of ImageMagick, and the latter might be made to work as well.)

On a GNU/Linux system, you can probably install the libgraphicsmagick++1-dev package, and the equivalent of build-essential, and then type make at the prompt.

On MacOS, I recommend using Homebrew. Once you have that, these commands should work:

brew install graphicsmagick libtool
brew link graphicsmagick libtool
make

I will happily include contributions of working build instructions for other platforms, but I cannot support them directly.

Running

These are the programs that are available:

./encode-file input.png secret.data output.png

Encodes the secret data file into the two low-order bits of the input image, producing the output image. No guarantees if the secret data does not fit. A small change to the code determines whether it fills any remaining bits randomly, or leaves them as they were.

./decode-file input.png secret.data

Extracts the two low-order bits of each channel, writing them to the secret data file. Note: uses the entire image, so there will be some binary data left over at the end if the secrets were shorter than the original image.

./encode public.png private.png output.png

Embeds a private imagine within a public one, using 6 bits per channel from public, and 2 bits per channel from private. The result is stored in the given output filename.

./decode input.png output.png

Extracts the lowest two bits per channel from the input image, to form the output image.

./tweaky N input.png out

Specify N = the number of bits (1-7) to tweak. The output files will be named out-0s.png, out-1s.png, out-rand.png, where it tweaks the lowest N bits in the input image.

./shifty input.png out

Simulate left-shifting the channel representations, one bit at a time. The output files will be named out0.png, out1.png, etc.

./spy X Y image1.png [image2.png ...]

Identify the color of the specified X,Y coordinate in each image. Prints the color in hexadecimal and binary.

You can’t perform that action at this time.