From b44c5adb5d189bb691d12fed775d24a345a19a14 Mon Sep 17 00:00:00 2001 From: Luis G Date: Sun, 19 Jun 2016 21:39:31 -0300 Subject: [PATCH] Expose registered file extensions This adds a new method in Image (registered_extensions) that exposes the internal EXTENSION dictionary to consumers of the library --- PIL/Image.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PIL/Image.py b/PIL/Image.py index 4ab40620f..e5543a7eb 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -2478,6 +2478,16 @@ def register_extension(id, extension): EXTENSION[extension.lower()] = id.upper() +def registered_extensions(): + """ + Returns a dictionary containing all file extensions belonging + to registered plugins + """ + if not bool(EXTENSION): + init() + return EXTENSION + + # -------------------------------------------------------------------- # Simple display support. User code may override this.