To reduce the number of possible attack vectors on a website, which would be the best way to limit formats, the Python Imaging Library can read a set of well-known good codecs (GIF, JPEG, PNG).
Thus, users could not send more exotic formats and use possible codec errors for buffer overflows, etc.
Preferably at runtime.
source share