Finding MIME type for a data stream

Tobiah toby at
Fri Mar 9 17:40:39 CET 2012

On 03/08/2012 06:04 PM, Dennis Lee Bieber wrote:
> On Thu, 08 Mar 2012 15:40:13 -0800, Tobiah <toby at> declaimed
> the following in gmane.comp.python.general:
>> Pasting images may sound weird, but I'm using a jquery
>> widget called cleditor that takes image data from the
>> clipboard and replaces it with inline base64 data.  
> 	In Windows, I'd expect "device independent bitmap" to be the result
> of a clipboard image...

This jquery editor seems to detect the image data and
translate it into an inline image like:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALU...

I'm parsing those out with regular expressions and decoding
the base64, and putting the resulting image data into a blob.
Hmm... there's the mime type right there.

More information about the Python-list mailing list