views:

104

answers:

2

I would like to be able to take a stream of 1's and 0's and convert it to a format that jpg can read, I.E. suppose I wrote a program and compiled and got an exe, then took and ran the 1's and 0's from the exe through said program, it would produce a .jpg. Any tips on what I need to do? I am hoping it's not as difficult as I'm suspecting it is.

Update: Suppose you took any old image, and brought it down to the (I suppose) Raw format, just one's and zero's, now suppose you took those 1's and 0's and somehow decoded them what kind of program would you get (obviously not a functioning one), but now I was thinking suppose we went the other way and took a .exe and lined all the 1's and 0's in some format that an "image" looks like, is it possible to see a picture, that's what I would like to discover. (I hope that explains what I'm interested in), so no the format doens't really matter, it could be bmp for all I care, just I want to see if there is in any way an image in a program that is distinguishable in a program.

+1  A: 

Are you talking about steganography? This would be taking some hidden message (could be an executable file) and hiding it in an image file. Obviously, the image file will bloat up a bit, but I think this is what you're talking about. The Wikipedia page has a few tools that are out there like StegFS and or MP3Stego.

Update

Upon re-reading your question, do you just want something that'll be a two color image with one color representing 1s and another being 0s? So the binary sequence 0110 1101 1010 1101 would produce an image like:

wbbw
bbwb
bwbw
bbwb
mjschultz
I don't know what to expect, I just thought...hey, start parsing the .exe x bits at a time (not sure what the standard "color width" would be) and just see what get's output, I guess indirectly yes it could and would be hiding the .exe in the jpg, but I was more interested in what the jpg of said "message" would look like, is it possible that some peoples programs are in fact works of art.... ;)
onaclov2000
+1  A: 

Well, the "right" approach would be to use a JPEG encoding library with your favorite programming language.

If you want to get started generating JPEGs right away, one option you have is to have your program encode the image in PPM (a simple text-based bitmap image format), then use the cjpeg utility to convert it to JPEG. Example:

foo.exe > out.ppm

Now, out.ppm (stolen from Wikipedia) contains:

P3
# The P3 means colors are in ASCII, then 3 columns and 2 rows, then 255 for max color, then RGB triplets
3 2
255
255   0   0     0 255   0     0   0 255
255 255   0   255 255 255     0   0   0

With this, you can run:

cjpeg -outfile out.jpg out.ppm

This is by no means a fast or robust way to generate JPEGs, but it can help you get started quickly.

Joey Adams
PPM is a good idea. I was thinking XPM myself :)
no
Looks interesting, I downloaded a zip, but I don't really see instructions to install on windows, so I'll have to do some investigating, I was hoping it was a simple .exe file i can run rather then compiling from source.
onaclov2000