4 ms·
I'm guessing the bmp format happens to look like ascii for certain pixels with certain colors. I wonder if this works in reverse. Maybe we can program the Mona
by rheide 16y ago
I'm guessing the bmp format happens to look like ascii for certain pixels with certain colors.
I wonder if this works in reverse. Maybe we can program the Mona Lisa in C.
- JoachimSchipper 16y agoC code is too "random" to produce nice images. You can use the least significant bits to hold some data; Google "steganography" (this is just the most basic).
- JonnieCache 16y ago>C code is too "random" to produce nice images In a world where it is possible to compute a file that contains its own MD5, I wouldn't bet on this. Wish I could find the link, there was some feted programmer who had a friend that bet him such a thing was not possible. He proceeded to write an algorithm that found such a file by brute force. I wouldn't count on the eventual C being pretty though. See also: electronic musicians hiding pictures in their music http://www.bastwood.com/?page_id=10 http://www.bastwood.com/?page_id=10
- JoachimSchipper 16y agoYou're right: sane C code is too "random" to produce nice images. ;-)
- JonnieCache 16y agoOne hacker's insanity is another's pastime. http://www.de.ioccc.org/main.html http://www.de.ioccc.org/main.html
- JoachimSchipper 16y agoYeah, that's what I thought of too. Has it been done yet?
- RodgerTheGreat 16y agoIn Java, source files can contain unicode escapes[1] of the form '\uXXXX' which are expanded prior to tokenization. In effect this gives you several options for what characters can exist in a given "pixel". I think that this, combined with careful application of whitespace and comments, should easily provide enough flexibility to make arbitrary code look roughly like a desired bitmap. [1] http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#100850 http://java.sun.com/docs/books/jls/second_edition/html/lexic...
- JoachimSchipper 16y agoJust \uXXXX (or C trigraphs etc) doesn't give you much to play with, and I'd say that selectively tokenizing Java is cheating.
- mrcharles 16y agoExample of a python script in a bitmap: http://www.bluh.org/codemap.bmp http://www.bluh.org/codemap.bmp Ultimately it's never going to be pretty if it's human readable as the range of bytes used will make a lot of greyish tones. C/C++ wouldn't look a lot different I doubt, but if you want you can grab my python script (PIL required) and pack some source files and see for yourself: http://www.github.com/mrcharles/codemap http://www.github.com/mrcharles/codemap (script has some bugs with alignment, but other than that, works)