How can you hide information inside a jpg or gif photo?
Asked Answered
P

9

26

How can I write some information inside a photo file like jpg or gif without destroying the image? and of course without showing it on the photo since the whole idea is to send information in the file of photo undetected by anyone (to provide security/privacy to some extent)!

Pre answered 1/8, 2009 at 8:19 Comment(3)
Please don't tag compound words. "information" alone is completely useless tag for this question; and the technical term for this is "steganography." Please don't remove that. en.wikipedia.org/wiki/SteganographyArtwork
Thanks for the hint, I didn't know that before! :)Pre
Store the information in the EXIF data.Ultima
M
4

You can store some information in image metadata. In fact that's how man digital cameras 'tag' the photos their making (camera model, date and time, GPS coords etc.).

This data format is called EXIF (Exchangeable Image File Format). There are a lot of examples how to use it in programming languages. Here's the example in Java.

If you want to prevent users from reading this data you can encrypt them somehow, but they will always be able to remove it from your picture (by opening in Photoshop and using Save As for example).

Mclain answered 1/8, 2009 at 8:26 Comment(7)
So "Save As" in PhotoShop would remove any metadata? Do you know a software that would allow editing it?Pre
I think photoshop will rewrite this data with it's own data. I think there are plenty EXIF editors, for example I found freeware Quick EXIF Editor photo-freeware.net/quick-exif-editor.phpMclain
This answer (while good) doesnt relate to the question. Exif doesnt hide information. Exif is metadata, not steganography.Bergschrund
"Guillaume" is there other place in the photo file where you can hide data in?Pre
Yes, if you want to hide data in a photo, have a look at the answers talking about steganography. The first 2 answers (for the moment) are very good.Bergschrund
This doesn't really "hide" information. It's stored in the file in plain text. Numerous graphics programs will read and display it.Ellerd
The biggest con about the EXIF data is, it might be lost. Have you uploaded any photo to Facebook? This really shouldn't be answer to this question.Robbins
C
49

You can concatenate a gif and a zip (the information you want to hide) into one file. Gifs are read from the start of the file, while zips are read from the end of the file.

To create such a file in linux:

$ cat file1.gif >> outfile.gif
$ cat file2.zip >> outfile.gif

The resulting file should have the size of file1.gif and file2.zip together and should be openable by any gif viewer and zip file handler.

Cilurzo answered 1/8, 2009 at 10:51 Comment(6)
Probably the easiest way to hide information :) But how do you retrieve it?Kyl
as i said, you can open the resulting file (outfile) with any standard archiver that can handle zip files and extract the information.Cilurzo
Ups. I only read the first part. I'll try the zip part later.Kyl
This is UNIX specific. I have a Windows solution.Robbins
I also have a Windows solution, but as opposed to @SantoshKumar I would like to share it with you ;-) copy /b "file1.gif"+"file2.zip" "outfile.gif"Satem
Couldn't you just do cat file1.gif file2.zip > outfile.gif?Nette
E
32

I'm sure there are many ways. Here's one:

In a photograph, minor variations in color would often be unnoticable to the naked eye, or even if noticed, might easily be mistaken for flaws in the quality of the picture.

So to take a simple example, suppose you had a gray-scale GIF image where the pallette is arranged in order from white to black with a smooth range of grays in between. I'm not sure how much you know about graphic file formats, but in GIF you have one byte per pixel, with each possible byte value mapping to some specific color. So in this case we could say pallette #0=RGB(0,0,0), pallette #1=RGB(1,1,1), ... palette #255=RGB(255,255,255).

Then you take an ordinary, real photograph. Break your secret message into individual bits. Set the last bit of each pallette index number to successive bits of your message.

For example, suppose the first eight pixels of the original photo are, say, 01 00 C9 FF FF C8 42 43. Your message begins with the letter "C", ascii code 0110 0111. So you change the last bit of the first byte to 0, changing the byte from 01 to 00. You change the last bit of the second byte to 1, changing the byte from 00 to 01. You change the last bit of the third byte to 1. It's already 1, so that makes no difference. Etc. You end up with the coded 8 bytes being 00 01 C9 FE FF C9 43 43.

The changes to the colors would be so subtle that it's unlikely that anyone looking at the picture would notice. Even if they did notice, unless they had a reason to be suspicious, they would likely just conclude that the picture was of less-than-perfect quality.

Of course nothing says you have to use 1 bit per byte for the secret message. Depending on how much degradation in quality you think you can get away with, you could use 2 bits per byte, or just change 1 bit in every other byte, etc.

Of course the same technique can be used with color photos: change the last bit in each of the RGB components to encode 3 bits per pixel, etc.

Ellerd answered 15/2, 2010 at 17:56 Comment(0)
O
11

Hey that method is called as Steganography. With that we can hide messages in not just images but also in audio,vedeo and other formats.

Here is an opensouce Steganography software called steganotool This project is an open source steganography tool that can be used to hide and extract text to/ from Bitmap images.

About Steganography Mediums

Steganography in images

This type of steganography is very effective against discovery and can serve a variety of purposes. These purposes can include authentication, concealing of messages, and transmission of encryption keys. The most effective method for this type of steganography is normally the least significant bit method. This simply means that the hidden message will alter the last bit of a byte in a picture. By altering that last bit, there will be relatively no change to the color of that pixel within the carrier image. This keeps the message from being easily detected. The best type of image file to hide information inside of is a 24 bit Bitmap. This is due the large file size and high quality.

Steganography in Audio

In audio files, the most prominent method for concealing information is the low bit encoding method. The low bit encoding method is somewhat similar to the least significant bit method used in image files. The secret information is attached to the end of the file. One of the issues with low bit encoding is that it can be noticeable to the human ear. If someone is trying to hide information, this could be risky, since it is so easily detectable. The spread spectrum method is another method that has been used in the concealment of information in audio files. What this method does, is it adds random noise to the audio broadcast. This method enables for the information to be spread accross the frequency spectrum and remain hiddden under the random noise. The last method seen in audio steganography is echo hiding data. This method seeks to hide information by using the echos that occur naturally within sound files. Then, extra sound can be added to these echos, extra sound being the concealed message. This is a sufficient way to hide information, expecially since it even improves the sound of the original audio file in some cases.

Steganography In Video

Steganography in Videos is basically hiding of information in each frame of video. Only a small amount of information is hidden inside of video it generally isn’t noticeable at all, however the more information that is hidden the more noticeable it will become. This method is effective as well, but must be done right or else reveal more information instead of hiding.

Steganography In Documents

This is basically adding white space and tabs to the ends of the lines of a document. This type of Steganography is extremely effective, because the use white space and tabs is not visible to the human eye in most text/document editors.

You can also refer to this open source project

This article can be very useful.

Opportuna answered 21/8, 2012 at 2:1 Comment(0)
M
4

You can store some information in image metadata. In fact that's how man digital cameras 'tag' the photos their making (camera model, date and time, GPS coords etc.).

This data format is called EXIF (Exchangeable Image File Format). There are a lot of examples how to use it in programming languages. Here's the example in Java.

If you want to prevent users from reading this data you can encrypt them somehow, but they will always be able to remove it from your picture (by opening in Photoshop and using Save As for example).

Mclain answered 1/8, 2009 at 8:26 Comment(7)
So "Save As" in PhotoShop would remove any metadata? Do you know a software that would allow editing it?Pre
I think photoshop will rewrite this data with it's own data. I think there are plenty EXIF editors, for example I found freeware Quick EXIF Editor photo-freeware.net/quick-exif-editor.phpMclain
This answer (while good) doesnt relate to the question. Exif doesnt hide information. Exif is metadata, not steganography.Bergschrund
"Guillaume" is there other place in the photo file where you can hide data in?Pre
Yes, if you want to hide data in a photo, have a look at the answers talking about steganography. The first 2 answers (for the moment) are very good.Bergschrund
This doesn't really "hide" information. It's stored in the file in plain text. Numerous graphics programs will read and display it.Ellerd
The biggest con about the EXIF data is, it might be lost. Have you uploaded any photo to Facebook? This really shouldn't be answer to this question.Robbins
C
2

If you want to hide data (text, another image, whatever) in a jpeg file, you can simply append it to the end of the file. When the image is viewed, you'll only see the original image and your added data will be ignored.

While not a super-duper way of hiding data, this is a good way of hiding another jpeg, as if anyone opens the file in notepad or a hex editor, they will probably not notice that there are two jpegs and not one because the end of the second image will just look like the first anyway.

Coronel answered 14/3, 2012 at 4:22 Comment(0)
C
1

In windows you can use simple command to hide archive in image : copy /b cat.jpg + Documents.rar cat_new.jpg. And then use for example winrar to extract data ftom image as from archive.
But better way is to use Steganography.
simple program for it for linux and windows : http://linux01.gwdg.de/~alatham/stego.html
using this program you will use pass phrase, without it nobody even will know, that you hided some data in picture ))

Chura answered 29/1, 2015 at 11:27 Comment(0)
P
1

compressed data in gif files is in variable sized chunks. each chunk starts with a length byte. Usually these chunks are 255 bytes of data (and the length byte says 255) except for the last two chunks (the last one is 0)

But you could re-code the gif with chunks whose size spells out the message eg using characters for ASCII text or bytes 1 2 3 4 representing 00 01 10 11 binary data,

byte-frequency analysis on the gif would reveal fewer than expected 255 bytes. and the size would be larger than the original, but the image would look exactly the same.

Pearson answered 15/3, 2017 at 23:43 Comment(0)
B
0

You don't need any type of advanced tool to hide a file in an image –– you just you need to know some basic DOS commands… just follow the link below, to see how to do this (it’s a short description of image steganography):

https://www.youtube.com/watch?v=ox9ArqXtaWw&list=PLqEKOAKK4IbSTfDJZE_lH-DiOjOzZUczx&index=2

Bartle answered 2/4, 2014 at 18:13 Comment(0)
I
0

I've actually found information embedded in digital FOIA releases from DoD, US AEC and CIA.bAm I just seeing what I want to see, it's so freaking weird and coincidentally

Incomprehensive answered 11/1 at 1:41 Comment(2)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Pronucleus
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewEquipollent

© 2022 - 2024 — McMap. All rights reserved.