Information Security Stack Exchange is a question and answer site for information security professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to hide files inside a picture. The files may be music or video. Is it technically possible to do this? If so, how?

I searched on Google to find methods. Please suggest some methods for beginners. I don't know where to start, so please guide me.

Important note: Modifying the size of an image up to a certain extent e.g., before hiding image size: 1MB and after hiding image size can be up to 4MB.

I referred to the following URLs: - United Kingdom

These are some examples, sir.

share|improve this question
Are you asking how the tools work? Or how to do it without the tools? (I think you need the tools to do it) – user11101 Jul 29 '12 at 9:47
Since hiding data inside an image is steganography by definition, I don't get what you mean by hiding files inside images without steganography tools. – CodesInChaos Jul 29 '12 at 9:49
have you ever programmed something, because otherwise you are a bit out of your league here... – Lucas Kauffman Jul 29 '12 at 10:04
"I don't know much about bridges, but can you tell me how to build a suspension bridge over the Thames to carry trucks? Would I need to use steel?" – David Schwartz Jul 29 '12 at 12:13
By definition, hiding files inside an image is steganography. So what you're asking is how to write a steganography tool, apparently as a class assignment. We can't do your homework for you. You need to read those papers and get to work. If there is something you don't understand in those papers, or you get stuck at some point, feel free to ask a specific question. – Gilles Jul 29 '12 at 17:16
up vote 18 down vote accepted

It is possible to hide files in other files. For pictures you can use the least significant bits of a RGB pixel definition.

A pixel has 3 bytes defining its color. Light Sea Green is defined by: 32,178,170 (R,G,B)

This translates to binary: 00100000,10101100,10101010

When we change the last bit of these, the color in an image does not change significantly. Therefor we can use the Least Significant bit of every color value of the pixel. This gives us 3 bits per pixel we can use.

So take a text, convert it to its binary representation and then write an algorithm that changes the LSB of every R,G and B value in the picture to the bit of that text. If you have a text of 128 bits long, you will need 128/3 pixels to hide that text.

Lets say I have a text who's binary representation is:

01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001 00100000

This text is 13 bytes long, meaning there are 13*8=104 bits. We know we can hide up to 3 bits in a pixel, so 104/3= 34.666, so we need 35 pixels.

So if we have a picture we'll use the first 35 pixels. To show you how it works, I'll give an example with two pixels. We can hide 6 bits in there, the first six bits of our text is 010010

Our pixels are:

pixel1,R: 00010101
pixel1,G: 01011111
pixel1,B: 10111100

pixel 2,R: 10010001
pixel 2,G: 00010101
pixel 2,B: 11011100

Now we can just change the last bit for every color value to the representative bit of the text:

pixel1,R: 00010101 ---> 00010100 (changes to 0)
pixel1,G: 01011111 ---> 01011111 (remains the same)
pixel1,B: 10111100 ---> 10111100 (remains the same)

pixel 2,R: 10010001 ---> 10010000 (changes to 0)
pixel 2,G: 00010101 ---> 00010101 (remains the same)
pixel 2,B: 11011100 ---> 11011100 (remains the same)

If we want to extract the text from the image, we just look at the LSB of the new pixels, we get:

P1 R: 0
P1 G: 1
p1 B: 0

P2 R: 0
P2 G: 1
P2 B: 0

This is our row: 010010

share|improve this answer
Just don't store the image as a jpg :) – monoceres Aug 4 '12 at 0:53
@monoceres Why? – Abraham Nov 21 '15 at 9:52
@Abraham JPG uses lossy compression, this means that the exact RGB values will not be preserved after encoding, corrupting the encoded data. Using a lossless format such as PNG is fine. – monoceres Nov 22 '15 at 12:39

Without using any steganography tool(!!)

In Windows: create a .rar archive with the files that you want hide, from a command prompt digit:


Done! Use WinRar to access to the hidden files into JPG image.

Linux: create a zip archive with the files that you want hide,

[tombo@palantir Immagini]$ zip TEXT.TXT.ZIP TEXT.TXT

hide the zip file in the image:

[tombo@palantir Immagini]$ cat MYIMAGE.JPG TEXT.TXT.ZIP > MYNEWIMAGE.JPG

Done! Use unzip to access to the hidden files into JPG image:

[tombo@palantir Immagini]$ unzip MYNEWIMAGE.JPG
warning [MYNEWIMAGE.JPG]:  5288 extra bytes at beginning or within zipfile
(attempting to process anyway)
inflating: TEXT.TXT
share|improve this answer
You haven't hidden anything. Naming an archive MYIMAGE.JPG does not make it an image any more than naming my cat Rover makes him a dog. – Gilles Jul 29 '12 at 19:42
Sure, I know it perfectly! But the OS will show you the file as an image. If you double clik on the icon the OS will open it like an image. The question was... hide a file without steganography! – tombolinux Jul 29 '12 at 20:01
@Gilles Actually this does work, you just add bytes to the image, it's just not really that covert. But it doesn't answer the OP's question as these are still tools – Lucas Kauffman Jul 29 '12 at 20:01
@tombolinux without steganography tools, I think the OP has to do an assignment for school and needs to write his own tool. – Lucas Kauffman Jul 29 '12 at 20:02
I'll upvote.. it's a crappy answer, but it's an answer. – cutrightjm Jul 30 '12 at 0:14

Have you done research into the tools themselves to see how they work?:

I simply did a search for steganography on github with a c++ filter.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.