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