Skip to content

Image control loaded tif file without quality DPI

Rajavasanth

Asked Nov 26, 2015, 1:17 AM EST1 answer
Share
LinkedInX
As i load the tif file in image control ,the tif files shown blur,how to improve the quality(DPI) of tif file
source code:
C#
  private void RibbonButton_Click(object sender, RoutedEventArgs e)
        {
               Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
               dlg.InitialDirectory = "c:\\";
               dlg.Filter = "Image files (*.tif)|*.tif|All Files (*.*)|*.*";
               dlg.RestoreDirectory = true;
               bool? result = dlg.ShowDialog();
               {
                      string selectedFileName = dlg.FileName;
                      FileNameLabel.Content = selectedFileName;
                      BitmapImage bitmap = new BitmapImage();
                      bitmap.BeginInit();
                      bitmap.UriSource = new Uri(selectedFileName);
                      bitmap.EndInit();
                      ImageViewer1.Source = bitmap;
                  }
        }
 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    It appears you're using the WPF Image viewer. The TIFF files already contain pixel data at a specific DPI. This means loading into the BitmapImage should not have any effect on the image's quality.

    I can think of 2 possible causes for this:

    1. It might be the way the Image control is displaying the bitmap. Check the value of the Image.Stretch property to see if the problem is caused by stretching.

    2. If it's not a stretching problem, the original image might be of low quality. You can check that by comparing to well-known software that supports all or most TIFF sub-types such as LEADTOOLS.
    0