Forum Discussion

jsc's avatar
jsc
Regular Contributor
12 years ago

help on color tolerance needed

Hi all,



in my test 1-2 screenshots regularly fail on low color tolerance. I first tried to handle it by using pixel tolerance, but the failing pixels were too much.



But the color difference is just 4%.

I know, that the parameter has the range of 0 ... 255  representing the rgb spectrum, but I do not really know how to use it.



can someone explain me

1) how can I set the color tolerance to accept slight changes in red?

2) how can I set the color tolerance to accept slight changes in blue?

3) how can I set the color tolerance to accept slight changes in green?

4) how can I set the color tolerance to accept slight changes in grey?

5) how can I set the color tolerance to 4%?



I read all the documentation but there are no real exaples, there is just said that 0 needs identical pixels and 255 accepts even 2 different images, that's not too helpful.



thanks & best regards,

Joachim



3 Replies



  • I assume you're using a bitmap comparison?



    Not something I use myself. (WAY too prone to false failures for my liking!)



    However, this: http://support.smartbear.com/viewarticle/55590/#ColorTolerance



    Suggests you can alter tolerance for each part of the RGB values. This tolerance will be applied to all pixels compared during a bitmap check.



    R = Red / G = Green / B = Blue. Range of each being 0-255. All colour are made up from these three. So bright red is 255,0,0 .... bright green is 0,255,0 .... bright blue is 0,0,255 .... black is 0,0,0 .... white is 255,255,255 ..... etc etc. The link suggests you can tweak tolerance on each part individually with 0 being no tolerance going all the way up to 255 being total (ie. any colour is OK) tolerance. So setting all three to a low number will allow a low variation in RGB values to get through.



    Assume there are settings for this in the bitmap checkpoint when you set it up?



    Sounds a bit odd to me though. I wouldn't expect RGB values to alter by small amounts on different runs unless they're something that is tweaked by the user during runtime ...
  • maximojo's avatar
    maximojo
    Frequent Contributor
    Hi,



    I have dealt with this extensively as we test flash applications which perform dynamic anti-aliasing/smoothing. Image comparisons can be very flakey across flash as well as different browsers!



    Yes if you set the image tolerance to e.g. 20 that means that it allows for a variance of 20 in each of the components i.e. R, G and B.



    You do have access to the individual pixels to process them on your own and create your own image comparison functions. I would think in script that this would be slow though but it is possible. So you can go:



    pictureObject.Pixels(2,5) and get the RGB value at that  pixel and perform the comparison yourself.



    Of course with small images this would be ok but with hundreds of thousands of pixels (e.g. 1024x768 image is 786,432 pxiels) I'm not sure how fast it would be.



    You could also create your own plugin in .NET and then perhaps pass your images to that for processing. Maybe that would be faster?



    But that's all I could think of at the moment :) Sorry I couldn't be of more help!



    Cheers

    Mark
  • jsc's avatar
    jsc
    Regular Contributor
    Hi,



    thanks for your reply!



    The problem is, that you cannot alter the tolerance for each part of the RGB values. I expected that and would easily understand that.

    But there is just one value that can be changed from 0 to 255. It's called color tolerance.

    I now guess, that if I set it to 20 then the color tolerance is 20 for R, 20 for G and 20 for B.



    I'd like to set the color tolerance to a small amount as I am checking some web-application and chrome sometimes renders lines differently (small difference in grey).



    But I am open to better solutions, if you say that you're no friend of bitmap comparison.

    But I have to do the gui-test. :-)



    Best regards,

    Joachim