Skip to content

Instantly share code, notes, and snippets.

@Novakov
Created August 6, 2017 14:18
Show Gist options
  • Save Novakov/c9c18c5bb0fd47be804fe5942f2b1ecf to your computer and use it in GitHub Desktop.
Save Novakov/c9c18c5bb0fd47be804fe5942f2b1ecf to your computer and use it in GitHub Desktop.
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