From 67c1258cfcb9dc23b000c0fe572da59f0cf76217 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 f49834e5b..e368ef187 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -2512,6 +2512,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.