from binascii import a2b_base64
data = 'MY BASE64-ENCODED STRING'
binary_data = a2b_base64(data)
fd = open('image.png', 'wb')
fd.write(binary_data)
fd.close()
Python / PIL: Create and save image from data uri