tags:

views:

30

answers:

2

Hi,

first: do u know why I can't get the method FromFile? ex: I can't write Image.FromFile

second: Do u know how I could get the Image Dimensions in c# WPF?

A: 
  1. Because the FromFile static method is from System.Drawing namespace. In wpf you've to set the image source using the Source property. Take a look at this example in msdn

  2. You can use the Height and Width property for setting the dimensions

Veer
+1  A: 

Use the below code to get dimensions of image

BitmapImage image = new BitmapImage(new Uri(@"c:\Images\Image1.JPG"));
double width = image.Width;
double height = image.Height;
Ragunathan