Created
May 7, 2019 00:26
-
-
Save zzj0402/f4ad56de2f2c4f542aafd9f685aec250 to your computer and use it in GitHub Desktop.
Open and store images with base64 encoding
This file contains hidden or 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 base64 | |
with open("D:\\cyber-security\\Assignment3\\t.png", "rb") as imageFile: | |
str = base64.b64encode(imageFile.read()) | |
print(str) | |
fh = open("D:\\cyber-security\\Assignment3\\s.png", "wb") | |
decoded = base64.b64decode(str) | |
fh.write(decoded) | |
fh.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment