Created
May 17, 2011 20:10
-
-
Save Eckankar/977272 to your computer and use it in GitHub Desktop.
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 python | |
import sys | |
import pyexiv2 | |
import os.path | |
def main(): | |
if len(sys.argv) < 2: | |
print "Specify file to examine, please." | |
filename = sys.argv[1] | |
meta = pyexiv2.ImageMetadata(filename) | |
meta.read() | |
tn = pyexiv2.exif.ExifThumbnail(meta) | |
if tn.data == "": | |
print "No thumbnail found." | |
return | |
(path, fn) = os.path.split(filename) | |
thumbfilename = os.path.join(path, "tn_" + fn) | |
tn.write_to_file(thumbfilename) | |
if __name__ == '__main__': | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment