0
votes

I'm loading large images on a WPF window to make some adjustments (like brightness and contrast) but when I try to load a large image (3000x2000 or 4000x3000) my image converts automatically to a lower resolution (usually 1024x600)

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

What can I do to keep the original resolution of my images in the BitmapImage object?

2
Could you post the XAML of your myImage control and it's containers? - Daniel

2 Answers

0
votes

Try using an ImageSource object instead:

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

Sounds strange. Try to set myImage.Source directly in XAML.

Control should keep original image

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