determine if file type by extension is supported #727
Answered
by
dlemstra
ChuckSavage
asked this question in
Help
-
I've the following code, but by no means is it exhaustive. Is there a helper method in the library that will tell me by extension if the library can handle the image?
|
Beta Was this translation helpful? Give feedback.
Answered by
dlemstra
Sep 7, 2020
Replies: 2 comments
-
You could check if the extension can be found in MagickNET.SupportedFormats
.Any(format => format.IsReadable &&
format.Format.ToString().Equals(extension.Substring(1), StringComparison.OrdinalIgnoreCase)); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ChuckSavage
-
Thanks, this helped a lot. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could check if the extension can be found in
MagickFormat
. But if you want to check if the format can be read you will need to useMagickNET.SupportedFormats
. Maybe something like this: