This article demonstrate how to fetch image format like (jpeg, jpg, png, gif etc.) from base 64 source using python.
To determine image format from base64 source following code will be helpful.
try:
import cStringIO as StringIO
except ImportError:
import StringIO
from PIL import Image
image_stream = StringIO.StringIO(base64_source.decode('base64'))
image = Image.open(image_stream)
filetype = image.format
Be the first to comment.