Home > Software engineering >  How to reverse (or scale down) dithering made by alternating two pixels?
How to reverse (or scale down) dithering made by alternating two pixels?

Time:11-25

I am looking for the formula (and its explanation) that gives the perceived color resulting from a quincunx arrangement of two other colors. The result is obviously not linear, because if I create an image with alternated RGB colors #E00000 (red) and #0000E0 (blue), and compare it with the mathematical average #700070, I see a big difference on the rendering.

On the image below, the left part is composed with #E00000 and #0000E0 colors, while the right is only #700070:

Comparison with #700070

I know there is a solution, because when I use GIMP to unzoom the dithered part, it magically continues to show the exact color I feel, but this time with an effective RGB code, which is #980098. This conversion is also made by the scaling feature when I select the "linear" algorithm... (Well, am I wrong, or despite its name it does not produces linearity at all?)

On the image below, the left part has still no purple in its pixels, whereas the right part is the #980098 purple:

Comparison with #980098

At least under my screen, if I don't look too carefully this image, it looks like a single purple band with no variation.

So what is the formula, and why? How to mathematically get this #980098 from #E00000 and #0000E0?

CodePudding user response:

It looks like the following conversion procedure is applied:

  • Convert color levels from enter image description hereenter image description here

    The RGB values of J are exactly #980098.

  • Related