import base64
from django.core.files.base import ContentFile
format, imgstr = data.split(';base64,')
ext = format.split("https://stackoverflow.com/")[-1]
data = ContentFile(base64.b64decode(imgstr), name="temp." + ext) # You can save this as file instance.
Use this code snippet to decode the base64 string.