Skip to content

Instantly share code, notes, and snippets.

Created July 17, 2017 12:41
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save loufranco/61d86e7392342c40f9021024387a5dd1 to your computer and use it in GitHub Desktop.
A Python script to make red/cyan 3D photos
from PIL import Image
import sys
# Check arguments
if len(sys.argv) < 3:
print "Usage: python <leftimage> <rightimage> <3doutputname>"
# Open the left and right images
imLeft =[1])
imRight =[2])
# Split the images into Red, Green, and Blue
lRed, lGreen, lBlue = imLeft.split()
rRed, rGreen, rBlue = imRight.split()
# The 3D image is the Red from the Right image
# And the Green and Blue from the Left one
im3D = Image.merge('RGB', [rRed, lGreen, lBlue])
# Show it
# Save it if we have an output filename
if len(sys.argv) > 3:[3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment