Created
November 12, 2017 23:08
-
-
Save ramalho/ccd58b503ccd257f1a3408423f8dcef9 to your computer and use it in GitHub Desktop.
Utility to "convert" Sony PMP photo files to JPEG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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