Videography
Make a 3D Picture From Two Real Mars Photos. The Files Are Free.
Download NASA’s actual left and right rover images and combine them into a red-and-cyan 3D picture with a short tested Python script.

NASA has a pair of photographs of the same Martian crater. They look almost identical, but one was made for the left eye and the other for the right. Put the two together in the right colour channels and you get a picture you can view with old-fashioned red-and-cyan 3D glasses.
That is a pretty fun way to understand stereo photography, and you do not have to fly to Mars to try it. NASA makes the original images available to download. I used those actual files to make the example in this article, with a short Python script and the free Pillow image library.
You will need a computer, Python, the Pillow package and red/cyan 3D glasses to see the depth effect. Without the glasses the result will look like a grey photo with coloured edges. This is a simple technical experiment, not a one-click phone app.
Feature: our cropped red/cyan combination made from NASA/JPL’s actual left-eye and right-eye images of Endurance Crater. Images courtesy NASA/JPL; channels combined, cropped and resized.
Why are there two pictures?
Our eyes see a scene from slightly different positions. A stereo pair records two related views so each eye can be shown a different image. Your brain can use the differences to perceive depth.
NASA’s Opportunity rover made these left and right views of Endurance Crater in 2004. They are panoramas, so you will notice some black space and irregular edges where the original images were joined. That is part of the source material, not damage caused by your computer.
The red/cyan version is called an anaglyph. The left image is placed in the red channel and the right image in the green and blue channels. With a red filter over your left eye and a cyan filter over your right, each eye receives a different view.
It is not perfect full-colour 3D. These starting images are monochrome, and anaglyphs can show coloured ghost edges or cause eye strain if the pair is uncomfortable. Stop and adjust the viewing size, or take a break, if it does not feel right.
First, download the actual left view

A crop of PIA05861, the left-eye view. Courtesy NASA/JPL; cropped and resized.
Open the full-size left-eye image and save it into a new folder on your computer as left.jpg. If your browser opens the picture instead of downloading it, use its save-image command and choose that filename.
This is NASA catalogue item PIA05861. The full original is much wider than the crop above: 4,253 by 1,162 pixels. Keep the original dimensions for this exercise; do not resize only one of the two photographs.
Now get the matching right view

The corresponding crop of PIA05862, the right-eye view. Courtesy NASA/JPL; cropped and resized.
Save the full-size right-eye image in the same folder as right.jpg. This is NASA catalogue item PIA05862, and it is the same pixel size as the left image.
Put the two files next to each other and look at a rock near the edge of the crater. The scene is the same, but the position is slightly different. That difference is the raw material for the depth effect.
You need a matched pair for this to work. Two unrelated Mars photos, or two copies of the same photo, will not automatically become a useful stereo image just because you colour them red and cyan.
Make the image with a small, tested script
I ran the following process on the two NASA originals. It converts each input to greyscale, checks that the dimensions match, then saves a full-size PNG called mars-anaglyph.png. The PNG is a new combination of the real source images; it is not NASA’s own finished 3D file.
First, install Python if it is not already on your computer. Open a terminal in the folder containing the two pictures and install Pillow:
python -m pip install pillow
On a system that uses python3 instead of python, use python3 -m pip install pillow. Then create a plain-text file in the same folder named make_anaglyph.py and paste in:
from PIL import Image
left = Image.open("left.jpg").convert("L")
right = Image.open("right.jpg").convert("L")
if left.size != right.size:
raise ValueError("Both images must have the same dimensions")
image = Image.merge("RGB", (left, right, right))
image.save("mars-anaglyph.png")
Run it from that folder with python make_anaglyph.py, or python3 make_anaglyph.py where appropriate. Open the new PNG and try it with your glasses, red lens on the left.
If the terminal says it cannot find left.jpg, check that the images are in the same folder and that your computer did not save a name such as left.jpg.jpg. If it says Pillow is missing, run the install command with the same Python command you use to run the script.
Here is the actual result

Our actual output made by combining NASA/JPL’s PIA05861 and PIA05862 using the script above. Courtesy NASA/JPL; converted to greyscale, channels combined and resized for display.
With glasses on, look at the crater rim and then the closer ground. The colour separation is the mechanism doing its job, although the panoramic stitching and the edges can be distracting. Try viewing the picture smaller if the depth feels uncomfortable.
The script does not automatically align the two photographs or repair black edges. It simply combines the files as supplied. That makes the code easy to understand, but it also means your result may show ghosting. A more advanced stereo editor can help align a different pair; it cannot manufacture matching views from unrelated scenes.
Compare it with NASA’s own 3D version

A crop of NASA’s own PIA05860 3D image. Courtesy NASA/JPL; cropped and resized. This is the official comparison, not the output of our script.
NASA also published its own red/cyan version, PIA05860. Compare it with the image generated above. They will not necessarily be pixel-for-pixel identical: NASA’s finished image is its own processing, while this exercise uses a direct channel combination.
That distinction is useful when you are learning. You can see both a simple result you can reproduce and an official reference made from the real mission imagery. Neither needs an invented interface or a pretend photograph.
Can you use a different image pair?
Yes, but start with two properly matched images of the same stationary scene from slightly different horizontal positions. Use the same camera settings and frame size where possible. Moving people, trees or clouds can make alignment harder because the scene changes between shots.
Before combining a pair, check the orientation: swapping left and right can make the depth feel reversed. Both files must have identical pixel dimensions for the script above. If you crop or resize, apply equivalent changes to each image and keep copies of your originals.
For a first real-world attempt, a small still-life scene is easier than trying to capture a moving pet. Place the camera securely, take the first frame, shift it a small distance sideways without rotating it, then take the second. This is a suggestion for your own experiment; the Mars pictures above came from NASA’s rover cameras, not from that home setup.
NASA/JPL’s image-use policy allows public JPL imagery to be used subject to its stated conditions, including credit and no implied endorsement. Check the source and rights for any different image pair, especially if another organisation or photographer is credited.
Download the left image and the right image, run the little script and compare your result with NASA’s version. You will have made a real 3D picture from a real place on another planet, which is a fairly decent afternoon project.
Sources
Share this article
Know someone who would enjoy this? Pass it along.
