Announcement

Collapse
No announcement yet.

Error when viewing dark pixels in grayscale png and bmp files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Reported Error when viewing dark pixels in grayscale png and bmp files

    Hello,


    I noticed something strange when viewing PNG files with irfanview. I created a very small test image, size 20x1 pixels (see attached "test.png"). This test image has the values 0 - 19 in 20 pixels. If I open this image in irfanview and inspect the image, I see strange results:
    * number of unique colors = 7 instead of 20
    * the histogram shows 4x 0, 4x 6, 3x 9, 3x 12, 3x 15, 2x 18, 1x 20
    * click on individual pixels and look at the RGB values in the title bar => pixel 0-3 are 0, pixel 4-7 are 6, pixel 8-10 are 9, pixel 11-13 are 12, pixel 14-16 are 15, pixel 17 and 18 are 18, pixel 19 is 20.

    I tried the same with a BMP file and got identical behavior. If I open these files in paint.net, paint ... I see all values correctly.

    This seems like there is a gamma & degamma processing step with rounding issues applied in irfanview when loading these types of images.

    BTW: using irfanview 4.44 - 32 bit on Win7 64 bit.
    Attached Files

    #2
    I do not see this.
    I found it very difficult to click on all the points in a 1 pixel wide image, so I turned off all resampling and wound up the zoom. I could then find your 20 shades of gray by clicking on them. They were all as they should be and the Histogram was as expected too.

    Click image for larger version

Name:	20 shades of gray.png
Views:	1
Size:	23.3 KB
ID:	81582
    Last edited by Mij; 02.02.2017, 11:28 PM.

    Comment


      #3
      OK, strange... I also have all resampling turned off and zoomed in to 1000%.

      Do you know any setting / plugin which might have such an effect? I went through all options/settings and couldn't immediately see one.

      Comment


        #4
        That striped effect in the histogram can be the result of trying to Decrease color depth too far.
        You can see at the bottom of my example that I am using 8bpp (256 colors). If you try to decrease to 16 colors then clearly you cannot show all 20 of your shades. I cannot see why you should get that effect unless you are doing something to the image that I am not doing.

        Comment


          #5
          It's not color depth decreasing, because it's not uniform. It only happens in the dark pixels, hence my idea that it's somehow gamma-processing related. See for example the attached 16x16 image which has the values 0-255. Again, irfanview shows this with only 220 unique colors, with some of the dark shades removed. Also attached, the histogram from irfanview on this 16x16 image. As an additional test, I launched irfanview without any plugins (renamed the "plugins" folder) and confirmed that the issue is still present (so not related to any bad plugins).

          Ok, further testing, I was able to get a bit deeper into this and how to reproduce it:
          => turn ON view -> display options -> use resample for fitting
          => turn ON image -> resize/resample -> try to improve gamma for resample
          => open the image and have it fit to the window
          => check the histogram


          So, I guess the real bug here is that the option "try to improve gamma for resample" is changing the content of the image. If the image has been resampled once with the "improve gamma" option ON, the in-memory representation of the image is changed. It has an effect on the histogram and even if you turn off resampling, you don't see the original image again. I would have assumed the "improve gamma" option only had an effect on the display representation of the image, not the actual image content that is used for calculations etc...


          Click image for larger version

Name:	test.png
Views:	1
Size:	137 Bytes
ID:	81594
          Click image for larger version

Name:	test_histogram.png
Views:	1
Size:	21.8 KB
ID:	81595

          Comment


            #6
            Strange

            Hello. Perhaps the following problem is related to this.

            I have scanned a diapositive. The scanned image has a size of 10278 x 6851 pixels and is available in 24 bitsPerPixels.

            The same image can only be displayed incorrectly in IrfanView 4.44, while other image programs can display it properly.

            The error appears only in very dark parts of the image. For clarification, I took a section from a very dark part of the picture.

            Look here:

            IrfanView 4.44 - 64 bit

            PhotoScape X Pro 2.5

            Gimp 2.9.5 displays the image exactly as PhotoScape does.

            It is also strange that IrfanView provides a different color representation of the image than other image programs, regardless of whether I enable or disable color management in the settings. This can be well understood in the 2 image excerpts.

            Perhaps I will open a new thread for this topic.
            Attached Files

            Comment


              #7
              Have you enabled any of the resampling options in View, Display options?

              We really need original scans to make any meaningful comparisons.
              Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

              Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

              Comment


                #8
                Yes, I agree that the histogram for the image marked as Irfanview is spread out more at the left hand end than the one marked as Photoscape.

                I opened the Photoscape image in Irfanview and saved it again from there as a Jpeg (80% quality and no boxes ticked in the save options).
                The histogram still looks exactly the same as the original Photoscape one when I open it again. I saved it again with Display option resampling on and it is no different.

                If I play with that Gamma correction option as the OP did in the viewing tab of Properties/Options , and set it to on with any value other than 1.0, then it does affect the histogram as you might expect. Other than that I have no idea what you could have done in Irfanview to get that spread out histogram you posted.

                I used 32bit Irfanview (like the OP) and not 64bit but when I tried my 64bit system last month to try to reproduce what the OP was reporting I did not see any difference.
                Last edited by Mij; 23.03.2017, 05:25 PM.

                Comment


                  #9
                  I have also checked the resampling options to prevent them from being a source of error.

                  The original image is in tiff format (uncompressed). It has not been edited in any way with IrfanView.

                  If the image is only scanned with the SilverFast AI scanning program, IrfanView appears to display it normally. But as soon as the processing of the tonal values ??came into play, IrfanView could not represent the picture properly.

                  Since I wanted to find out more about the strange behavior, I have just carried out detailed tests. For some months this problem has bothered me and now suddenly everything is displayed without any error in IrfanView, too...

                  Sorry, I can not reproduce this problem.

                  I have made the following observations regarding the differences in color representation between IrfanView and PhotoScapeX. The Trial of PhotoScapeX does not seem to work with a color profile embedded in the image. I think it just does not support color management.

                  Comment

                  Working...
                  X