2012-11-17 85 views
0

我在WPF窗口上加載大圖像以進行一些調整(如亮度和對比度),但當我嘗試加載大圖像(3000x2000或4000x3000)時,圖像會自動轉換爲較低分辨率(1024×600通常)將大圖像加載到圖像控件中

Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); 
openFileDialog.ShowDialog(); 

BitmapImage bitmap = new BitmapImage(new Uri(openFileDialog.FileName)); 

imageResolution.Content = bitmap.Width + "x" + bitmap.Height;//label to see dimensions 
myImage.Source = bitmap;//image 

我能做些什麼讓我的圖像的原始分辨率在BitmapImage的對象?

+0

難道您發佈'myImage'控制的XAML和它的容器? – Daniel

回答

0

嘗試使用ImageSource對象,而不是:

Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); 
openFileDialog.ShowDialog(); 
ImageSource imageSource = new BitmapImage(new Uri(openFileDialog.FileName)); 
image1.Source = imageSource; 
0

聽起來很奇怪。嘗試直接在XAML中設置myImage.Source。

控制應該保持原始圖像

<Image x:Name="image1" Stretch="None" Source={Binding PathToImage}>