3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Burning visible images onto CD-Rs with data (beta)

Step 2Convert 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.
« Previous StepDownload PDFView All StepsNext Step »
18 comments
Mar 21, 2007. 9:00 PM;) says:
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!! - ;)
Jun 5, 2011. 10:18 AMkoduor says:
interesting....save as .dat....then burn as data cd with nero.interesting.
May 23, 2007. 10:19 PMkainino says:
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.
Jul 30, 2006. 5:35 AMspinach_dip says:
How can I get this to work with octave? I don't and never will own Matlab, so I need to run it in octave, anyone know how? Or maybe it could be rewritten in C?
Jul 30, 2006. 5:40 AMspinach_dip says:
Figured it out, but it doesn't work:

octave:1> img2cd('logo.gif')
n128sec = 1
error: invalid row index = 83
error: invalid column index = 142
error: evaluating binary operator `<' near line 176, column 25
error: if: error evaluating conditional expression
error: evaluating if command near line 176, column 5
error: evaluating for command near line 174, column 3
error: evaluating for command near line 156, column 1
error: called from `img2cd' in file `/home/pabs/img2cd.m'

Any idea how to fix this?
Nov 11, 2006. 7:11 AMbomholt says:
In octave try:

octave:1> img = imread('sohv.jpg')
octave:2> img2cd(img)

Regards
JB
Sep 30, 2008. 6:18 PMdombeef says:
does it work
Aug 3, 2008. 8:05 PMsniper120 says:
>> Important <<

Talking about a C/C++ ver, this code is easy to read and understand to a c++ programer(noob or pro!). It would be easy to convert it.(open in free SCITE to read it first!)

C++ Code simplified (I am a noob at C!)

< Start >

/* Simple C++ code convertion for matlab code */

/*

This is the base of the C code you would need. You would have to xor the data. Note: Looked for C++ BITXOR/XOR function but could not find any!

"this sequence of bytes is xored with the bytes of sector to "scramble" the data" --matlab code

Then setup the calabration for the type or brand of CD used. Get the center radius and other things. The comments were not clear in the program!

There was picture adjustment code to make the picture as it was on the computer screen.

"i came up with these fudge factors to attempt to straighten my picture. they work OK for my CD-Rs.they probably won't work for yours" --matlab code

Then write the image to 1/0 bits as a file. The matlab code tried to write at 128 sectors( A second?)

>>>>> NOTE: Most of the code in the MATLAB is math! The C++ code would be much better to read and less lines! <<<<<

*/

#include <stdio.h>

int main ()
{
FILE * CDfile;
/* First lines of the MATLAB code I can't get about the Xor :( */
char code[] = { The Code };
/* State the variable || (Below) open the file on the CD to be writen to. */
CDfile = fopen ( "f:/temp/CDHOLOGRAM.data" , "wb" );
/* Write the data (file) to the CD */
fwrite (code , 1 , sizeof(code) , CDfile );
/*

Sorry! I don't know how to write it to the CD (fwrite?). . Close the file (below code).

*/
fclose (CDfile);
return 0;
}

/* This takes much more time to read, then to load http://www.3-z.net (My website) ! */

< End >

I hope that C++ pro will take this on!
Nov 25, 2007. 9:54 AMSoksume says:
umm noob question but how do i save these or what ever it just redirects me to som crazy html doc when i click
Aug 16, 2007. 3:56 PMjonnxt says:
you sould make a c++ version!!!
Jan 31, 2006. 8:47 PMchoppahead says:
Any idea how to correct his error? I've never used MATLAB and I'm new to programming, so I'm a little lost. I figured out how to run the code and parse the input in, but I have no idea how to get around this error. I'm using a black and white, 142x83 JPG...

??? Attempted to access img(83,142); index out of bounds because size(img)=(1,9).

Error in ==> img2cd at 176
if img(ny(k), nx(k))<128
May 23, 2007. 9:49 PMkainino says:
Try, in this order, these two things: 1. Convert your image to a monochrome bitmap (BMP). You should be able to do this by opening the old image with MS Paint and "save as"-ing. It is unlikely that JPEG compression is built into the program. 2. The error message seems to indicate that the image may be too big, so try reducing the size of the image.
Mar 21, 2007. 9:01 PM;) says:
i dont know if it works eather so be willing to waste a cd... for the greater good...
May 7, 2006. 11:22 AMzhfox says:
I can't open these on my windows comp
May 29, 2006. 6:03 AMyusufk says:
Jul 30, 2006. 5:42 AMspinach_dip says:
Ubuntu is just a commercial version of Debian.
Jan 4, 2007. 8:25 PMPM3D says:
No, Ubuntu is free. They will even ship you FREE a CD of Ubuntu.
Jul 30, 2006. 12:22 PMvendeep says:
to get this to work u need to have matlab to run the scripts... u have to rename these two files to img2cd.m and calcCoord.m, and place them in the same folder.... then in the img2cd.m filename at line (140 i believe) then if its giving error, comment lines 176 - 179. then save this file to run this, in the matlab command line type in img2cd('filename'); it will take a while, but might work, didnt burn to a cd, but i got the scripts working...
Jul 30, 2006. 9:57 AMgobabushka says:
I think tht somebody should convert the code to C. I would, but I dont know anything about MATLAB or C programming.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
50
Followers
4
Author:argon