Announcement

Collapse
No announcement yet.

The meaning of IrfanPaint tolerance settings?

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

    Solved The meaning of IrfanPaint tolerance settings?

    I am using IrfanPaint constantly but I am not sure how to interpret the tolerance settings. For example: When the tolerance is 24, does that mean +24 and -24 pixels from the current setting or +12 and -12. it would really help to know. Thanks
    Irfanview 4.54, Win 10 Pro 64bit 16gb RAM, Intel UHD graphics

    #2
    The tolerance value has nothing to do with distances in pixels, but how close other pixels are to the chosen colour value. A tolerance of zero will only fill pixels of the identical colour.
    Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      Originally posted by Bhikkhu Pesala View Post
      The tolerance value has nothing to do with distances in pixels, but how close other pixels are to the chosen colour value. A tolerance of zero will only fill pixels of the identical colour.
      Please accept apologies for my poorly framed question previously, and will attempt to rephrase it.

      These "index" numbers come from the 256 color grayscale and the terminology is copied from the IrfanPaint palette. Index "200" is indicated when the grayscale color of (200, 200, 200) is selected.

      Assume that the color index background is set to 200 and the foreground is set to 143.

      If the tolerance is set to 24, does this mean that the color replacer changes any background color between 200 +/-24 (224 to 176) or is it 200 +/-12 (212 and 188)?

      Obviously if the tolerance is set to 0, then the change only affects the exact colors specified in the color indexes.
      Irfanview 4.54, Win 10 Pro 64bit 16gb RAM, Intel UHD graphics

      Comment


        #4
        There must be a formula that relates the tolerance to the RGB or HSL coordinates but I have not worked out what it is.
        Attached is an HSL color selector wheel that I have overpainted using the Irfanpaint Color Replace tool. You can see what I chose as the foreground and background colors and the area that was replaced with a tolerance setting of 25.
        Make what you can of that.
        Click image for larger version

Name:	Tolerance wheel.png
Views:	1
Size:	154.0 KB
ID:	81378
        Last edited by Mij; 31.01.2016, 08:15 PM. Reason: Tolerance was 25 (as shown in Paint dialog)

        Comment


          #5
          Thanks for an excellent example. The reason I asked here is to save time in creating a color table with grayscale, because it's easier to do. Most of my work is with black & white photos and drawings prior to color photography and printing (19th century). I was hoping that Bhikkhu Pesala would ask Irfan, since he would know and save me the work. If that's not forthcoming, then I will have to create it, and will post the original and the results. This issue has been on my mind for a very long time because I am cleaning and trying reproduce the original shades as accurately as possible, for images I upload to Wikimedia commons.
          Irfanview 4.54, Win 10 Pro 64bit 16gb RAM, Intel UHD graphics

          Comment


            #6
            Before stopping development work on the Irfanpaint plug-in the author made the whole project open source, so if you have some knowledge of C++ you can actually look at the code that is used to do the colour replacement.
            The link to it is still on this forum at https://irfanview-forum.de/showthread.php?t=6375

            I think the code module is called ColorReplacer.cpp

            Comment


              #7
              Mij, thanks for the info and the links. Need to decipher the variable assigned to tolerance, and then may be I could figure it out.
              Irfanview 4.54, Win 10 Pro 64bit 16gb RAM, Intel UHD graphics

              Comment


                #8
                "Took the bull by the horns" and emailed the question to the developer, and here is his reply:

                "The comparison is ultimately done by the similarColor function; two colors are considered "similar" if all their channels differ by less than the threshold. Thus, in a grayscale image if the gray level is 200 and the tolerance is set to 24 it will replace anything between 176 and 224."

                I hope it helps others as well.
                Irfanview 4.54, Win 10 Pro 64bit 16gb RAM, Intel UHD graphics

                Comment


                  #9
                  Thanks for the feedback. I have marked the thread as solved.
                  Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

                  Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

                  Comment


                    #10
                    Thanks ineuw. I was just coming to the conclusion myself that the tolerance setting must represent a square box in RGB color space.
                    I used the 8bf filter "Color Cube" to look at the color selector wheel from my post #4 above. Color Cube is a free 8bf filter from Martin Vicanek, that you can use in Irfanview, which provides an amazing visualisation of RGB color space.
                    The color selector wheel contains all the fully saturated colors and so displays as 3 sides of the cube. Replacing part of it using the Irfanpaint color replace tool at a tolerance of 25 punches a neat square hole in the side of the cube. In the second image attached below the cube has been rotated so that it is face on to the green side and displayed at 100% zoom. The side of the cube then measures 256x256pixels and the hole measures 50x50 as expected.
                    Click image for larger version

Name:	Color cube.png
Views:	1
Size:	247.1 KB
ID:	81379 Click image for larger version

Name:	Color cube - Green side at 100%.png
Views:	1
Size:	456.4 KB
ID:	81380
                    Last edited by Mij; 31.01.2016, 08:55 PM. Reason: Tolerance should be 25 not 20. Extra view of cube added.

                    Comment


                      #11
                      Mij, it's amazing. My crude approach was to create strips of grayscale because as far as I know, it only has 256 shades, and then play with the tolerance and pick up the values with the color picker.
                      Irfanview 4.54, Win 10 Pro 64bit 16gb RAM, Intel UHD graphics

                      Comment

                      Working...
                      X