Last active
April 8, 2016 12:10
-
-
Save fgorina/353a80115e2ad9585de396cb519685f0 to your computer and use it in GitHub Desktop.
Import.py
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
import appex | |
import Image | |
from PIL.ExifTags import TAGS | |
import clipboard | |
import Plot | |
def get_exif(fn): | |
ret = {} | |
i = Image.open(fn) | |
info = i._getexif() | |
for tag, value in info.items(): | |
decoded = TAGS.get(tag, tag) | |
ret[decoded] = value | |
return ret | |
def main(): | |
if not appex.is_running_extension(): | |
print 'This script is intended to be run from the sharing extension.' | |
return | |
files = appex.get_file_paths() | |
if files: | |
with open(files[0], "r") as rfile_: | |
data = rfile_.read() | |
components = files[0].split("/") | |
l = len(components) | |
name = "Logs/" + components[l-1] | |
print name | |
with open(name, "w") as wfile_: | |
wfile_.write(data) | |
else: | |
print 'No input image found' | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment