Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose registered file extensions #1955

Closed
lggomez opened this issue Jun 15, 2016 · 4 comments
Closed

Expose registered file extensions #1955

lggomez opened this issue Jun 15, 2016 · 4 comments

Comments

@lggomez
Copy link
Contributor

lggomez commented Jun 15, 2016

Is there any way of getting the file extensions supported by the library?
Usually it's a good practice to expose the supported types or extensions, specially in libraries that handle files, so the consumer can have a way to obtain or check its target extensions based on the ones provided by the library

I'm not very familiar with Pillow's code but this method in Image.py should do the trick:

def registered_extensions():
    """
    Returns a dictionary containing all file extensions belonging
    to registered plugins
    """
    if not bool(EXTENSION):
        init()
    return EXTENSION

Anyway, it's just a suggestion so you shall take it with a grain of salt. Keep up the good work on this fork

@radarhere
Copy link
Member

From my understanding, preinit() should not be necessary when immediately followed by init(). It's just a version of init() that aims to be faster by only covering the most popular formats.

@lggomez
Copy link
Contributor Author

lggomez commented Jun 19, 2016

Indeed, after checking I see that using init() will be enough, I corrected it

Do you consider this a worthy addition? If so I can make the pull request

@radarhere
Copy link
Member

Potentially, yes. I won't be the one to ultimately merge it, but you should certainly feel free to create a PR as a way of moving this forward.

@radarhere
Copy link
Member

This has been done in #2343.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants