Skip to content

Instantly share code, notes, and snippets.

@ramalho
Created November 12, 2017 23:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramalho/ccd58b503ccd257f1a3408423f8dcef9 to your computer and use it in GitHub Desktop.
Save ramalho/ccd58b503ccd257f1a3408423f8dcef9 to your computer and use it in GitHub Desktop.
Utility to "convert" Sony PMP photo files to JPEG
#!/usr/bin/env python3
"""Extract JPEG files from Sony PMP files"""
import sys
import os
for name in sys.argv[1:]:
print(name, end='->')
with open(name, 'rb') as fp:
octets = fp.read()
base, ext = os.path.splitext(name)
new_name = base+'.jpeg'
with open(new_name, 'wb') as fp:
fp.write(octets[124:])
print(new_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment