I had success removing the CA1416 warnings by adding the following decorator to the top of the containing class:
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
I’m only on VS2019 and using .net 5, but it may work for you. I tried this with VS2019 .net5 console project (top of class Program) and a .net5 class library (top of the class).
I added the System.Common.Drawing nuget package.
My code included:
string inputPath = @"C:\mypath\mypng.png";
Image i = Image.FromFile(inputPath);