locked
Images are displayed differently under Win7 resp. WinXP RRS feed

  • Question

  • I found out that images are displayed differently, depending on your operating system. Here's the code:

    if (openFileDialog1.ShowDialog() == DialogResult.OK)
    {
    	Bitmap image = new Bitmap(openFileDialog1.FileName);
    	pictureBox1.Size = new Size(8 * image.Width, 8 * image.Height); //zoom by factor 8 to see individual pixels
    	pictureBox1.Image = image;
    }
    
    

    Screenshots and source code are available at ftp://thomas-leopold.dyndns.org/TIFFTest
    Use active FTP mode.

    You can find the original image file (a TIFF) and the source code in the zip file. Try it out...

    Not only my program is affected, but also the famous Paint.NET (www.getpaint.net).

    Any ideas what goes wrong here?

    Thomas Leopold

    Wednesday, February 16, 2011 5:02 PM

Answers

  • Under Win7, the saved image would contain the artifacts (see screenshots above), although the image has never been displayed.

    It's been decoded and encoded.  There's general agreement that Win7 shouldn't convert 8 bit gray scale to 4 bit gray scale, but reports have been filed at least a year ago and, as you see, it still does.  BS'ing about it on these forums will only get boiler plate from the compensated moderators.  Use connect or support if it concerns you.
    • Marked as answer by Thomas Leopold Thursday, February 17, 2011 8:32 AM
    Wednesday, February 16, 2011 6:31 PM

All replies

  • Win7 uses Windows Imaging Component for GDI+ graphics.  This results in many differences from earlier systems, particularly for indexed images and gray scale images.  It's been this way since the introduction of Win7, so it doesn't look like it's going to change.  Usually Win7 provides enhanced capabilities.

    Add to or file a report on connect.

    Wednesday, February 16, 2011 5:35 PM
  • Thanks for your reply.

    I just need to point out, that not only the display is affected. Consider the following lines of code:

    Bitmap image = new Bitmap(openFileDialog1.FileName);
    image.Save("Clone of " + openFileDialog1.FileName);

    Under Win7, the saved image would contain the artifacts (see screenshots above), although the image has never been displayed.

    Wednesday, February 16, 2011 6:18 PM
  • Under Win7, the saved image would contain the artifacts (see screenshots above), although the image has never been displayed.

    It's been decoded and encoded.  There's general agreement that Win7 shouldn't convert 8 bit gray scale to 4 bit gray scale, but reports have been filed at least a year ago and, as you see, it still does.  BS'ing about it on these forums will only get boiler plate from the compensated moderators.  Use connect or support if it concerns you.
    • Marked as answer by Thomas Leopold Thursday, February 17, 2011 8:32 AM
    Wednesday, February 16, 2011 6:31 PM