This project has moved and is read-only. For the latest updates, please go here.

Check if filetype is supported

Mar 7, 2014 at 5:58 PM
Edited Mar 7, 2014 at 7: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)?
Mar 7, 2014 at 7: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.