Created
August 6, 2017 14:18
-
-
Save Novakov/c9c18c5bb0fd47be804fe5942f2b1ecf 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
def download_photo(obc, local): | |
data = system.obc.read_file(obc) | |
with open(local, 'wb') as f: | |
f.write(data) | |
result = [] | |
rem = data[4:] | |
while len(rem) > 0: | |
part = rem[0:512 - 6] | |
result += part | |
rem = rem[512:] | |
rem = rem[0:] | |
with open(local + '.jpg', 'wb') as f: | |
f.write(''.join(result)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment