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:




pcplus.techradar.com/.../secrets-of-steganography/ - United Kingdom

These are some examples, sir.

  • 5
    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. Commented Jul 29, 2012 at 9:49
  • 1
    Just write your own code? Commented Jul 29, 2012 at 9:53
  • 4
    have you ever programmed something, because otherwise you are a bit out of your league here... Commented Jul 29, 2012 at 10:04
  • 11
    "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?" Commented Jul 29, 2012 at 12:13
  • 8
    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. Commented Jul 29, 2012 at 17:16

3 Answers 3


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

  • 5
    Just don't store the image as a jpg :)
    – monoceres
    Commented Aug 4, 2012 at 0:53
  • @monoceres Why? Commented Nov 21, 2015 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
    Commented Nov 22, 2015 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
  • 6
    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. Commented Jul 29, 2012 at 19:42
  • 2
    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
    Commented Jul 29, 2012 at 20:01
  • 1
    @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 Commented Jul 29, 2012 at 20:01
  • 1
    @tombolinux without steganography tools, I think the OP has to do an assignment for school and needs to write his own tool. Commented Jul 29, 2012 at 20:02
  • 4
    I'll upvote.. it's a crappy answer, but it's an answer.
    – cutrightjm
    Commented Jul 30, 2012 at 0:14

Have you done research into the tools themselves to see how they work?: https://github.com/Vsevak/stbmp

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .