2

As far as I can tell my question is not related to topics involved in Stenography or in the win.rar soluations I've seen to this where you are essentially hidding messages.

I am trying to figure out if there is a way to insert code into a file such as a jpg or png with a simple message, that could later be extracted by a program reading the file without having it encoded into the file either by slight differences in pixels or what have you in stenography.

I basically just want a tag along message that is a part of the file itself that is not brought up by the image reader but could perhaps be seen by a text reader of some kind.

I'm not sure how possible this is because I, for the most part don't understand the order/layout of the png/jgp/ect file aside from the RGB pixel code. How does it start, how does the image display tool know to stop displaying ect.

The way I'm envisioning it would be something like: pngStartCode -> RGBinfo --> png end code so image reader knows to stop -> start sequence that some kind of reader will recognize (possibly a new text reader) -> written text wanted to be communicated -> endcodeforreader

I may just be rambling about something ridiculous here but please let me know if this is at least possible.

user2097211
  • 333
  • 2
  • 5
  • 16

2 Answers2

3

You can use following command(Windows command prompt)

  1. Create a text file with your message, say "message.txt"
  2. Now choose target file(it can be any file like a.jpg,a.png,a.exe,..etc), say "image.jpg"
  3. Now execute follwing command

    copy /b "image.jpg"+"message.txt" "NewImage.jpg"

Above command will combine files(in binary mode) and creats a new file(in this case NewImage.jpg). Now if anyone opens image they will just see noraml image. If you want to look at text, you have open it with any text editor(Notepad) and scroll down to last, there you can find text.

Here it wont chage any pixels or any thing to image, it just appends text to image.

Rajeev
  • 843
  • 2
  • 11
  • 22
  • More or less just combining the .png/.jpg with the text file. Wow, a lot simpler than I would have suspected. Thanks @Rejeev, I'll give it a try. I suppose the real challenge is reading the text file without the png/jpg data interfering. – user2097211 Dec 25 '13 at 18:27
  • If you stick with PNG then take a look at the PNG specifications. The actual file length is predefined, and easy to get hold off. Anything after that is your data. – Jongware Dec 27 '13 at 00:22
0

It sounds like OP is asking about comment tags in the PNG specifications (i.e. adding data but without intent to hide it).

PNG files are broken into "Chunks". The image part is usually divided into several IDAT chunks; the color, size, etc are stored in an IHDR chunk, etc.

The iTXt, tEXt, and zTXt chunks are used for conveying text information associated with the image, so typically you'd look into using a tool to add those types of chunks. tEXt is for just plain text, zTXt is compressed.

More info on the PNG specification including what kinds of chunks are available can be found here, and you find chunk viewers on google.

For convenience at preset time (January 2021) here are a couple tools that will let you view, edit, and add chunks:

NOTE: I do not vouch for the safety of any of the above links. Please use standard caution when downloading any file from the internet. If you don't have your own anti-virus, Virustotal has one online you can upload individual files to for free.

Chris Rudd
  • 709
  • 7
  • 13