I'm trying to encode and decode the same image file using python using following simple code. But every time output file is larger than input file and it can't open. What's the problem in this code?
import base64
with open("img.jpeg", "rb") as image_file:
encoded_string = base64.b64encode(image_file.read())
decoded_string = base64.b64decode(encoded_string)
with open("test_img.jpeg", "w") as image_file2:
image_file2.write(decoded_string);
Original file: https://filebin.ca/3j6aIDlWEYdV/img.jpeg
Result file: https://filebin.ca/3j6arBo85Lcg/test_img.jpeg