Hello all,
I’m building a game for UWP and Windows Standalone in wich the user can upload an image to interact with and I just found a weird behaviour with the pics that comes straight from smartphones (at least samsung that is the one I own) when I read the Width(W) and Height(H)
I’m using:
Windows.Storage.FileProperties.ImageProperties imageProperties = await file.Properties.GetImagePropertiesAsync();
picWidth = Convert.ToInt32(imageProperties.Width);
picHeight = Convert.ToInt32(imageProperties.Height);
to get the W and H in UWP
and for Standalone:
using (var image = System.Drawing.Image.FromStream(fileStream, false, false))
{
picHeight = image.Height;
picWidth = image.Width;
}
both of them give the same result but in the images that comes from my Note9 the W and H comes inverted.
In the Pic’s Windows Properties the W and H are correct.
My Questions:
1.- Is there a metoth to Get the W and H as the Windows Properties shows
2.- Is there a way to detect or handle pics from smartphones,
With the UWP metoth I can get much more information about the Pic like orientation and with this info I can invert in the code but in the Standalone code I can’t find something like this.
Using:
UNITY 2020.3.3F1
Windows 10
Notes:
- In other windows apps (Photoshop, Photos, Paint) the Pics are shown in correct way
- With the UWP metoth I can get much more information about the Pic, like its orientation, and with this info I can invert the W&H in the code, but for the Standalone code I can’t find something like this.
- If I export or save the same Pics from the mentioned apps the issue is gone.