Check if filetype is supported

Mar 7, 2014 at 4:58 PM
Edited Mar 7, 2014 at 6:10 PM
This library supports impressive number of file formats so I was wondering is there way to check if file is supported before opening.

For example in a thumbnail viewer application what is be best way to check before attempting to to open as image?
Should I:
  • just wrap it in try/catch,
  • should I check all (extension=="jpg" || extension=="png"... and unintentionally maybe miss a few or hurt performance
  • or is there something like bool b =isSupported(myextension)?
Coordinator
Mar 7, 2014 at 6:35 PM
You can use MagickNET.SupportedFormats to get a list of all supported formats. Or you could use the names of the MagickFormat enum to get all the supported extensions.