First of all, let me say that people have found various ways to do this, and that this might not be the easiest way. A big benefit, though, is that the image data you end up getting is very easily accessible and manipulable. Also, this works with *a lot* of image formats, including JPEG, JPG, PNG, BMP, and others. Anyhow, let’s get started, shall we?
What you need
- A MindStorms NXT intelligent brick
- RobotC
- Paint.NET, a free image creation/ editing software which you’re going to use to create your image, with this plugin [LINK] installed. Don’t know how to install Paint.NET plugins? Refer to this page here [LINK].
Step 1: Creating or Importing your image
For creating your own image: open Paint.NET, click the “Image” menu, and then open the “Canvas size…” option. In the wizard, specify any image size, up to 100 pixels wide and 64 pixels high. Then use the pencil or any of the other tools to create your image.
For importing an image: open Paint.NET, click “open,” navigate to the desired image, and double click it. Then, go to the “Image” menu, open the “Image size…” option, and, in the wizard, specify any image size, up to 100 pixels wide and 65 pixels high.
Step 2: Making your image black and white
First, open the “Adjustments” menu and click “Black and White.” Then, again in the “Adjustments” menu, open “Brightness/ Contrast,” and, in the wizard that pops up, set the contrast to 100.
You can play around with the brightness to change how dark a color needs to be to become black, and how light a color needs to be to end up white. Once you’re satisfied with your results, hit the “OK” button and your image is ready for the next step.
Step 3: Saving your image
Open the “File” menu and click “Save as…”. You can save your image under any name, anywhere, as long as you make sure you select “Portable Bit Map Files (*.pbm)” from the “Save as Type” drop down menu. If this option is not available, you didn’t install the plugin right, so re-install it and try again. Click image to enlarge.
Step 4: Reformatting your image’s code
Next up, you need to turn the image you just created into something the NXT can actually use. Go to the folder you saved your image in, right click the picture, and hit “Edit with Notepad++”. In the code you end up with, remove everything before the 1′s and 0′s (usually the top two lines).
Then, hit ctrl and f on your keyboard to open the “Find” wizard. The next steps are very important, so pay close attention:
- In the wizard, go to the second tab, which should say “Replace”
- In the “find what” box, type ” ” [hit the space bar once], and in the “Replace with” box, type nothing. Hit “Replace all.”
- In the “find what” box, type “1″, and in the “Replace with” box, type “1,”. Hit “Replace all.”
- In the “find what” box, type “0″, and in the “Replace with” box, type “0,”. Hit “Replace all.”
- Finally, turn the code into a single line by going to the end of every line of code and hitting delete
Step 5: Displaying the image on your NXT
First of all, copy this code into your program somewhere:
int i, j;
int image[HEIGHT][WIDTH] = {PUT 1'S AND 0'S HERE};
for(i=0; i<HEIGHT; i++){
for(j=0; j<WIDTH; j++){
if(image[i][j] == 0){
nxtSetPixel(j,-i+HEIGHT-1);
}
}
}
Replace “WIDTH” with the width of your image, “HEIGHT” with the height of your image, and “PUT 1′S AND 0′S HERE” with your image code (copy and paste it between the curly brackets).
And there you have it: you can now display any image you want on your NXT screen using RobotC and some freeware :)







