In WPF c# loading an image from code in runtime, some images are loading when the width and height are switched so the width=height and height=width so the image is turned in 90 degrees. In the file system properties tab, the Width and Height are correct and the image is shown correctly. If I open this image in any imageViewer the image is shown correctly but if I open it in powerpoint the same issue is found and the image is turned. I downloaded some other codes in WPF and all are showing the image turned. most images are shown correctly.
For example This Image : https://www.dropbox.com/s/5fki0ew3gt78myi/TestImage_Widht4000_Height6000.JPG?dl=0
The Widht=4000and Height=6000 but if I get the bitmap.PixelWidth=6000 and bitmap.PixelHeight=400
Can anyone please help! Thanks
I have tried everything :(
var ImagefilePath = SelectedImagePath + "\\" + ((object[])(e.AddedItems))[0].ToString();
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(ImagefilePath.ToString(), UriKind.Absolute);
bitmap.EndInit();
// Set Image.Source
imgPhoto.Source = bitmap;
ImageInfoText.Content=" W=" + bitmap.PixelWidth + " H=" + bitmap.PixelHeight;