Burning Pictures on a Compact Disc Surface

by arduinocelentano in Circuits > Art

8766 Views, 156 Favorites, 0 Comments

Burning Pictures on a Compact Disc Surface

Burning Pictures on a Compact Disc Surface
preview.jpg
logo.jpg
14.jpg
04.jpg
02.jpg
09.jpg
13.jpg
11.jpg
08.jpg
06.jpg
03.jpg

The first compact disc was sold in 1982, that is to say 40 years ago. This project is my anniversary tribute to this technology. No, we are not going to use it as data storage. It’s obviously impractical nowadays. Well, if you turn it this way, actually we will store some data... Not digital but rather visual and not exactly on CD but on its surface... Pick up your old CD-RW drive and some compact discs from your garage. Because we are going to burn images on a compact disc surface. With an incredible rainbow effect. No LightScribe, no LabelTag. No hardware hacks or gimmicks. A regular CD-RW drive and a regular compact disc.

Did you know? Compact disc formats specifications are called Rainbow Books. The first one considered Digital Audio Compact Discs and was named "Red Book".

Supplies

00.jpg

Hardware

1. A regular CD-RW drive.

2. A regular compact disc. I recommend that you use one of the following:

  • Verbatim CD-RW (like one shown on the attached picture)
  • eProformance CD-RW 4x-10x
  • TDK CD-RW 4x-12x

No, they don't pay me for this. Unfortunately. The reason is that in other cases you'll need to guess disc's geometry yourself as it will be discussed later.

Software

1. CD burning software (like cdrtools)

2. My program to convert images to CD tracks. You’ll also need QT6 library and C++ compiler to build it.

Project's Origins and Credits

01.jpg
02.jpg

I know of at least two successful attempts to implement a similar technique. One was accomplished about 15 years ago by [argon] Instructables user. That code was more proof-of-concept than the universal method, but it was impressive! I suppose there was a huge amount of work behind it. Another attempt was made by a user with nickname [unDEFER] (no English documentation unfortunately). These two projects inspired me some time ago. And in fact my coordinate conversion code is mostly based on [unDEFER]’s implementation. I also used geometric parameters of some compact discs from that project. I acknowledge and am grateful to these developers for their contributions.

I played with color shades and different compact discs with moderate success and created a GUI with visual preview mode. A couple of my early experiments are shown on the attached pictures. I tried to implement a user-friendly solution but finally abandoned the project in 2008 due to a problem of calibration for every particular brand and type of compact disc that will be described further. Recently I found my old code and decided to share it. More as a tribute to the compact disc era, as I said. But maybe you will make some use of it (look for tips at the end of this text). I brushed the code up a little and ported it to modern Qt6. I considered porting to Python, but I still need C++ because audio track generation takes some time even on modern hardware.

The Short Story

surface.png

The short story is that compact discs are optical volumes. Data is encoded in areas with different optical properties and organized in spiral. You might have noticed a visual rim on a compact disc surface between written and unwritten areas. So by generating specific data that will form darker and lighter areas it is possible to burn visible images on a compact disc surface. Sounds easy, isn't it? Just convert an image to polar coordinates and here you are.

The Long Story

8-14.png
scrambler.png
sector.png

You may skip this section if you are not interested in technical details.

The long and real story is more complicated. If you really want to understand the concepts, I suggest that you read the so-called “Red Book” which describes all technical specifications. I am not going to retell the entire boring standard here, just name some key points.

The surface consists of “pits” and “lands”. They differ in light reflection properties. But it does not mean that “pit” is 0 and “land” is 1 or vice versa. In fact NRZI code is used to prevent long series of “pits” and “lands”. Which is good for data integrity but bad for picture burning. To make things worse, eight-to-fourteen modulation is also used, that is to say, each eight-bit block is translated into a corresponding fourteen-bit block according to lookup table. So if you are trying to write 00000000 and hope to see the darkest possible shade, it is translated to 01001000100000. And you can do nothing about it. The lookup table is constructed in such a fashion that it is impossible to have more than five 0s or 1s in a row. It decreases your color shades assortment dramatically. But it is still possible to pick several 14-bit values from the lookup table which will look differently. However, maximal contrast is unachievable. Not to mention scrambling and other significant details, the point is: even the simplest CD format uses a lot of uncontrolled data conversions and it is impossible to control each particular bit. If you are thinking about transferring this approach to DVDs or other optical discs, be ready to face even more technical magic.

But I still have not mentioned the real trouble you’ll face. All data is organized in one spiral that starts from the centre of the CD. And to make coordinates transitions, you should know its dimensions. You’ll need to know the size of the first circle and the step between circles of the spiral. Their acceptable ranges are defined in the standard, but precise values are different for every brand and sometimes for every pack of compact discs. The way to obtain them is a matter of guessing and spoiling a lot of compact discs. And this limitation must be the main reason why nobody has ever come up with a universal solution. I have included parameters of four compact disc types. If you are lucky enough to find one of them, you are likely to succeed. Otherwise you’ll need to make a test image with some rings and lines and try to calibrate your compact disc. It may take about ten iterations of guess-burn-repeat or more.

Preparing the Software

You’ll need a compact disc writing tool and my program to generate an audio CD track. To compile it from source code, you’ll need the Qt6 library. Just run

qmake

and then

make

Alternatively you could build the project with Qt Creator if you installed it. If you need a binary distribution for a specific OS, let me know and I’ll see what could be done.

Picking Up an Image

01.jpg
02.jpg

Click Edit→Load image and select an image file. I recommend that you use a high-contrast image. No need to mention that you will not be able to burn full color images. Well, in fact every image will have a recognizable rainbow palette when you finish. You can move and scale the image:

left mouse button — move image;

double click — center image;

mouse scroll wheel — zoom image.

Creating Audio Track

03.jpg
04.jpg
05.jpg

Click Edit→Create track and select the model of your compact disc. If it is not in the list (which is likely), you may input geometry manually. If you know the geometry of some compact disc which is not in the list, let me know and I’ll include it into the distribution.

Depending on your hardware, conversion will take some time. Finally you’ll get a huge Audio CD track.

Burning Compact Disc

06.jpg
01.png

Some people reported issues with some Windows CD burning software due to large file size. I tested it with command line tools like wodim and cdrecord, and it worked fine. With Windows too. So I suggest that you use them. For example:

cdrecord -audio dev=<recorder_device> <generated_track>

Remember that you should create an Audio CD.

Linux/Unix users might use their package managers to install CD burning command line tools or build them from source code. It depends on your particular operating system and distribution.

Windows users could download cdrtools for Windows here. After installing, open cmd command line (press Win+R shortcut and type cmd). Then type a command like one on the attached screenshot. If you have several CD recorders, you'll probably need to specify which one to use. If you use CD-RW disc, you'll likely want to erase it first. A command would look like cdrtools -blank=fast. For further information type cdrecord -help.

Final Thoughts

07.jpg
01.jpg
12.jpg

How could it be used? Initially there were no practical reasons for this project. But…

1. You could make a souvenir or an original geek gift with some photo or other image. For example, burn the Discworld map. :)

2. Alternatively you could make an item for your quest or escape room with some riddle. You could supply your participants with CD Player for misdirection and make them figure out that they should look, not listen. 

3. I’m not sure but maybe some holographic applications are possible. However, we are likely speaking about the infrared, not visible spectrum. 

4. It might be possible to implement a copy protection algorithm. Since all compact discs are slightly different, you should be able to use timeouts between particular areas readings to ensure that a compact disc is the original one. Even an exact copy is not exact geometrically speaking. I believe such algorithms have existed during the CD era. Maybe this trick is possible with modern optical discs.

If you have other ideas, let me know.


What about DVDs and other optical discs? Well, technically it should be possible. But keep in mind that data correction techniques are more complex there and you should be more precise with geometry. If you’ll find some brand with stable geometry parameters, you may give it a try. It’s a huge amount of work though. Speaking about holography, we might be able to deal with the optical spectrum.