Get list of available image formats

Hi,
is there a way to get list of image formats (filename extensions) that may be opened using “skimage.io.imread”?
I would like to filter the list of files to only the image-files that may be opened.

Hi @Ilya_Belevich,

This would depend on which loader plugin you use. By default, that is imageio, which supports these formats.

You can list them programmatically using:

import imageio
imageio.formats.show()

You can get all format names using:

imageio.formats.get_format_names()

To get the extensions supported by any specific format (SPE in this case):

imageio.formats['SPE'].extensions
1 Like

Hi Stefan,
thank you for the prompt reply, I think it solves the issue!

In the documentation mentioned that “By default, the different plugins are tried (starting with imageio) until a suitable candidate is found”
Does that mean that the following command will give me the complete list of all possible extensions for all plugins?

        filenameExtensions = list()
        for formatId in imageio.formats:
            filenameExtensions.append(list(formatId.extensions))
        filenameExtensions = [item for sublist in filenameExtensions for item in sublist]
        filenameExtensions = set(filenameExtensions)
        filenameExtensions = ["*" + item for item in filenameExtensions]