Stumbling Toward 'Awesomeness'

A Technical Art Blog

Sunday, April 11, 2010

Splitting MPO Files with ExifTool and Python

Many stereo cameras are using the new MPO format to store multiple images in a file. Unfortunately, nothing really works with these files (Other than Stereo Photo Maker). Here is a simple python wrapper around ExifTool that will extract the Right and Left image, and return EXIF data as a dict. I think this is probably easier than explaining how to use ExifTool, but you can see from looking at the simple wrapper code.

import mpo
#Name of MPO file, name of output, whether or not you want all EXIF in a txt log
mpo.extractImagePair('DSCF9463.MPO', 'DSCF9463', True)
#>>Created DSCF9463_R.jpg
#>>Created DSCF9463_L.jpg
#>>Writing EXIF data

The above leaves you with two images and a text file that has all the EXIF data, even attributes that xnView and other apps do not read:

exif =  getExif('DSCF9463.MPO')
print exif["Convergence Angle"]
print exif["Field Of View"]
#>>53.7 deg
print exif["Focal Length"]
#>>6.3 mm (35 mm equivalent: 35.6 mm)
posted by admin at 2:58 AM  


  1. Nice tool! I like python for the portability, so this is just what I needed. Thanks a lot!

    However, I have the feeling that for extractImagePair the left and right images are flipped. It looks like you take the first image to be right, while other tools take it as left, and looking at them left seems to make more sense.

    How did you decide which is which?



    Comment by DirkR — 2010/07/03 @ 9:53 PM

  2. Great tool! I just used this to resounding success to write a Python script to extract .jpg files from photos I’ve taken on my Nintendo 3DS. Thanks for helping me save some time!

    Comment by Nat — 2011/05/09 @ 1:06 AM

  3. If you don’t need the EXIF data, you get the images with PIL like this:-
    # get left and right images from .MPO file (based on C code from Andres Hernandez):-
    from PIL import Image
    from StringIO import StringIO
    file = open(r’F:\My Pictures\FinePix W3 3D\DCIM\100_FUJI\DSCF0007.MPO’, ‘rb’)
    left = # skip SOI and APP1 markers of 1st image
    data = # read both images
    offset = data.find(‘\xFF\xD8\xFF\xE1’) # find SOI and APP1 markers of 2nd image
    file = StringIO(data[offset:])
    right =

    Comment by Christopher Jones — 2011/06/18 @ 4:55 AM

  4. Any easy commandline way to create an mpo file from two JPGs?

    Comment by Aidan — 2011/07/09 @ 6:36 AM

  5. Hey there! Would you mind if I share your blog with my facebook group? There’s a lot of people that I think would really enjoy your content. Please let me know. Cheers

    Comment by Restaurant Games — 2011/12/15 @ 2:30 PM

  6. sure, no prob.

    Comment by admin — 2011/12/18 @ 3:32 PM

  7. Do you mind if I quote a few of your posts as long as I provide credit and sources back to your website?
    My website is in the exact same niche as yours and my users would definitely benefit from some of the information you provide here.
    Please let me know if this alright with you.


    Comment by omc trolling motor parts — 2014/05/17 @ 1:43 PM

  8. your comment says your site is

    Comment by admin — 2014/05/18 @ 8:33 PM

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress