Burning Visible Images Onto CD-Rs With Data (beta)

183,459

138

108

Posted

Introduction: Burning Visible Images Onto CD-Rs With Data (beta)

By carefully choosing the right 1s and 0s to burn to a CD, it is possible to burn visible images on normal CD-Rs. These images rely on the fact that the 1s and 0s created by pits in the CDs surface reflect light differently.

Step 1: Learn How CDs and CD-Rs Work

Data on a CD, or any optical media, is stored as a sequence of pits of varying lengths. To be precise, a 1 is represented by the change from pit to no-pit or the change from no-pit to pit, and a 0 is represented by no change in height (pit to pit or no-pit to no-pit). The pits and no-pits reflect different amounts of light; thus it is possible to draw images on CDs by appropriately arranging these 1s and 0s.

How do you arrange the 1s and 0s? It helps to know that the data is written along a spiral that starts from the center of the CD and spirals outward in a clockwise direction. The length of each bit is a fairly precise value (more on this later), and the pitch of the spiral, or the distance between successive spirals, is also a fairly precise value. Thus, using some math and some guesswork, it is possible to create a mapping from the nth bit in your data to an x,y coordinate.

Now we really have to look under the hood of CD data storage to figure out how to tell the CD writer to write a 0 or 1 for the nth bit. Data is organized as a sequence of sectors, each of which is 2352 bytes long. The data within each sector is organized in a particular way depending on what type of CD your are dealing with (data, audio, etc...). The most "raw" type of organization is known as "mode 2." Mode 2 does away with many of the nice things about CDs like error correction, but it gives us the most control over the bits. In a mode 2 sector, the first 12 bytes contain "syncing" data and the next 4 contain specific information about the sector. These bytes cannot be changed at the software level. (Maybe it is possible to write a driver that could change these?) The next 2336 bytes are free to be anything though. If this were all that happened to the data, our job would be easy. Unfortunately, there's a lot more data manipulation before the data actually gets written to the CD.

First, the data in each sector is "scrambled" by which we mean it is run through some math function which is supposed to "whiten" the data (i.e. keep the average height of the data on the CD half-way between pit and no-pit).

Second, the data is sent through a CIRC encoder, which applies some error correction codes.

Finally, the data is sent though an eight-to-fourteen modulator (EFM). This maps each 8-bit byte to a 14-bit sequence. This is to prevent long sequences of 0's (no change in height) which are hard for the CD drive to read.

The point is: drawing pictures on CDs is possible, so it should be done.

For a more complete (but still at some times cryptic) explanation of CDs, check out the freely available ECMA-130 specification.

Step 2: Convert a Picture to Data

Here are the MATLAB programs that I use to convert an image to a data file.

Use the freely available cdrecord program in "mode 2" to burn the data to a CD-R.

Step 3: Calibrate Your CD-Rs

Each brand (or maybe even set) of CD-Rs has slightly different properties such as track pitch or linear scanning velocity. Before successfully drawing a picture, it is necessary to determine what these values are. To do this, create a data file which represents a radial line. Draw this to the CD-R, and you may get a spiral. Now it's time for the guesswork. Try to change the values, to convert this spiral back into a radial line.

Step 4: Draw a Picture!

Here I've shown a CD-R with a picture of two people kissing burned on it. It's a little hard to discern because I haven't completely calibrated this CD-R yet.

Share

    Recommendations

    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Spotless Contest

      Spotless Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    108 Comments

    I am trying to burn many rings on a CD to make a very coarse diffraction grating of 95 lines per millimeter.

    If I get something I'll post an Instructable. The rings on the CD are to make a spectrometer that spreads out very long wavelength infrared energy. There is a big CO2 absorption band down there.

    It is related to global warming. Here is my blog on the subject:

    http://www.lowco2america.com/

    Linux has a yes command that can make big files of a test character. Use that to make a 700 megabyte CD. See what it looks like.

    This sounds like a very fascinating project.

    If I could find out details about how DVD data is written, i could probably hack out something in Python that will convert an image to a data file that can be written to a DVD, since a DVD might give better resolution than a CD (my excuse is i got a bunch of blank DVDs on hand but no CDs). I would love to see this project pursued more.

    with this thingy, can you still burn normal files to the disk?
    Thanks

    i'd love to see this project come out of beta, it's a genius idea

    nice idea.....

    user

    HIIIIIIIIIIIIIIII, I found something cool out i dont know how it works though or how you would use it. 1. in microsoft paint make an image you like 2. save it to desktop 3. go to note pad 4. go to open and click all files then find and open it 5. it should come out in a very long pattern with a lot of y's 6. figure out some way to write that to the cd I cant really do this so if someone could please post a "REPLY" to this comment!! thanks!! - ;)

    interesting....save as .dat....then burn as data cd with nero.interesting.

    What you saw in MS Paint is just notepad trying to read what is really a series of hexadecimal numbers, for example:
    if FF is white, 00 is black, and 01 means to go to the next line,
    FF00FF0100FF00010000000100FF00
    represents a small image of the letter A. This only indicates lines of black and white, so what you see here is already being used by the program.

    P.S. That string of numbers works as follows:
    FF00FF0100FF00010000000100FF00
    which becomes this when splitting bytes apart with spaces:
    FF 00 FF 01 00 FF 00 01 00 00 00 01 00 FF 00
    then, converting 01 to a new line, 00 to #, and FF to a space:
     # # ##### #
    and you should be able to read the letter in that.

    TUTORIAL ON HOW TO CONVERT MATLAB TO EXE http://www.onecore.net/howtocreate-standalone-executable-for-matlab-file.htm