xxxxxxxxxx
# reading as 'rb' will read the binary, which is necessary for copying images.
with open('img.jpg', 'rb') as rf:
with open('copied_img.jpg', 'wb') as wf:
chunk_size = 4096
rf_chunk = rf.read(chunk_size)
# Procedurally copy the image through chunks of information
while len(rf_chunk) > 0:
wf.write(rf_chunk)
rf_chunk = rf.read(chunk_size)
print("Chunk Updated")
print("Copy Complete")