Getting format from file extension and mime types

Vlastimil Zíma <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
Hi,

recently I encountered problem with PIL on saving images which filename 
had no extension. When I tried to save such image, PIL raises KeyError

   File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1423, in save
     raise KeyError(ext) # unknown extension

KeyError: ''


What is proper solution for such problem? I found out that I should 
specify format argument, so I wanted to use PIL's MIME dictionary, but I 
found out that it can not store multiple mime types for image format 
identifier, which is not very useful.

I would have to create mine dictionary that converts mime types to PIL 
formats, which I would like to avoid.

Any suggestions?

Vlastimil Zíma
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.