Skip to content

Instantly share code, notes, and snippets.

@JackDesBwa
Created January 31, 2020 04:16
Show Gist options
  • Save JackDesBwa/317ef94cc8c67c02c78c7e4b1e038b1a to your computer and use it in GitHub Desktop.
Save JackDesBwa/317ef94cc8c67c02c78c7e4b1e038b1a to your computer and use it in GitHub Desktop.
Transform MPO stereoscopic images into SBS parallel
#!/usr/bin/env python3
import sys
from PIL import Image
for p in sys.argv[1:]:
path_in = p
path_out = path_in.replace('.mpo', '.sbs.jpg')
imr = Image.open(path_in)
imr.seek(1)
iml = Image.open(path_in)
im = Image.new("RGB", (iml.size[0]+imr.size[0], max(iml.size[1], imr.size[1])))
im.paste(iml, (0, 0))
im.paste(imr, (iml.size[0], 0))
im.save(path_out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment