How to Hide One Image in Another (An Introduction to Steganography)

by joe57005 in Circuits > Computers

166603 Views, 56 Favorites, 0 Comments

How to Hide One Image in Another (An Introduction to Steganography)

6 indexed.gif
This instructible will demonstrate basic steganography by showing you how to hide one image in another.

For these instructions you will need:
Gimp
one image to hide,
one image to hide the other.

A Little Bit About Steganography

Steganography is the act of hiding information in something else. It is favorable over encryption because encryption only obscures the meaning of the information, steganography hides the very existence of the information, also, encrypted data tends to attract attention, which often proves fatal to any agent. This art (for lack of a better phrase) has been around for centuries, and has many forms, one common low-tech method is simple invisible ink, another, ancient method involved tattooing the information on the top of someone's head and allowing hair to grow over it. My favorite example is the artwork of Lord Baden-Powell, in which he hid the maps and plans of an enemy base in drawings of insects and leaves while posing as a naturalist.

The method i will show you hides an image by modifying each pixel in it's host. It only changes the least significant bits of each pixel, this means it makes tiny changes that are unnoticeable to a person.

Prepare the Image to Hide Part 1

1 preparation.png
2 palettes.png
In this step the image will be converted to 8 colors to reduce the amount of data needed to store it.

Open the image in gimp, and open the Palettes dialog box. (Dialogs > palettes)
Add a new palette, name it what you want.

Preparation Part 2

3 add colors.png
4 the new palette.png
Add the 8 colors.
Double click on the foreground color and type FF0000 into the html box.
click okay
in the palette editor, click 'add from foreground'

do this for all 8 colors:

FF0000
00FF00
0000FF
FFFF00
FF00FF
00FFFF
FFFFFF
000000

Click save:

Preparation Part 3

5 convert to indexed.png
6 indexed.gif
Now we'll convert the image to a format you can hide.

Click Image > Mode > indexed

select 'Use custom Palette' and select the palette you created.
Enable dithering. i recommend Floyd-steinberg. (try both ones to see which works best, hit control-z to undo and try again)
Click convert.

Make the Image Unrecognizeable...

7 the color map.png
8 edit the color map.png
9 darn near black.png
10 unrecognizeable.png
Click Dialogs > colormap
Double click each color and replace FF with 02 in the html box and click okay.
The image will get darker with each color until it goes black entirely.

Click Image > mode > RGB (this is CRITICAL)

Note: Using 01 would be better (less of a change), but i chose 02 just to make sure it works. try both to be sure.

Hide It!

11 the image to hide in.png
12 add new layer.png
13 paste in the layer.png
15 difference.png
Open the image to hide in.
Add a new layer from the layer dialog. name it what you want (or don't)
In the other (now black image) click edit > copy
and paste it into the new layer of the other image and click the anchor button in the layers dialog.
Now select Difference from the Mode menu.
Click image > flatten image.

Now the image is hidden. save it, but use a LOSSLESS format. that means use bmp or uncompressed png. If you compress the image, the hidden data will be corrupted and lost.

Get It Back!

16 add origional.png
10 unrecognizeable.png
17 contrast.png
6 indexed.gif
to recover the hidden image:
Open the container image.
add a new layer.
paste the original container image in the new layer and anchor it.
In the layers dialog select Difference in the mode menu. the image will turn black.
click Image > flatten image
click Colors > brightness/contrast.
set both sliders to maximum and click okay.
your image will be visible again!

Obviously the recipient of the hidden image will require a copy of the original.
Also, it's okay if you loose track of which is which, as long as one is the original.

Conclusion.

This was just a demonstration good for little more than impressing people. but this same method, done differently, can store any file small enough to fit. This can be used for good or evil. If you plan on using this, the best way to send the information is via the internet in the open. this is called a dead drop. (just leaving the information somewhere for anyone, hopefully it's target, to find)
Be warned, most sites, like myspace and instructables, compress their images to save space, which will destroy the hidden image.

Attached are some images to play with. have fun!







Obligatory disclaimer: This is for instructional purposes only, I am not responsible for the actions of the reader. sensitive information should not be sent using this method as it is very easy to detect and decode. Don't be stupid.

Downloads