File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,18 @@ class ImageOpener(Opener):
153
153
154
154
A trivial sub-class of opener to which image classes can add extra
155
155
extensions with custom openers, such as compressed openers.
156
+
157
+ To add an extension, add a line to the class definition (not __init__):
158
+
159
+ ImageOpener.compress_ext_map[ext] = func_def
160
+
161
+ ``ext`` is a file extension beginning with '.' and should be included in
162
+ the image class's ``valid_exts`` tuple.
163
+
164
+ ``func_def`` is a `(function, (args,))` tuple, where `function accepts a
165
+ filename as the first parameter, and `args` defines the other arguments
166
+ that `function` accepts. These arguments must be any (unordered) subset of
167
+ `mode`, `compresslevel`, and `buffering`.
156
168
"""
157
169
# Add new extensions to this dictionary
158
170
compress_ext_map = Opener .compress_ext_map .copy ()
You can’t perform that action at this time.
0 commit comments