Only for iPhone 11 images (from what I can tell) I get an error trying to open .jpg files with C#. All other files work perfectly. This is not one phone but multiple phones. I tried the three methods below, all fail. Note: trying to open any of these images in Photoshop fails with a "Program Error"
using (System.Drawing.Image img = System.Drawing.Image.FromFile(physicalPath)) **// out of memory**
{
if (img != null)
imgWH = new Dimensions { Width = img.Width, Height = img.Height };
}
Bitmap imgBit = new Bitmap(physicalPath); // **invalid paramater error**
var imageHeight = imgBit.Height;
var imageWidth = imgBit.Width;
imgWH = new Dimensions { Width = imageWidth, Height = imageHeight };
using (FileStream fs = new FileStream(physicalPath, FileMode.Open, FileAccess.Read))
{
using (System.Drawing.Image original = System.Drawing.Image.FromStream(fs, false, false)) // **invalid paramater**
{
if (original != null)
imgWH = new Dimensions { Width = original.Width, Height = original.Height };
}
}