In the past, I have done a bunch of such things. Smoothing can be done in different ways, but the way they are probably doing it here is a simple linear approach. This means that for each component R, G and B, they simply calculate the equation "y = m * x + b", which connects the two points and uses this to find the components between them.
m[RED] = (ColorRight[RED] - ColorLeft[RED]) / PixelsWidthAttemptingToFillIn m[GREEN] = (ColorRight[GREEN] - ColorLeft[GREEN]) / PixelsWidthAttemptingToFillIn m[BLUE] = (ColorRight[BLUE] - ColorLeft[BLUE]) / PixelsWidthAttemptingToFillIn b[RED] = ColorLeft[RED] b[GREEN] = ColorLeft[GREEN] b[BLUE] = ColorLeft[BLUE]
Any new color in between now:
NewCol[pixelXFromLeft][RED] = m[RED] * pixelXFromLeft + ColorLeft[RED] NewCol[pixelXFromLeft][GREEN] = m[GREEN] * pixelXFromLeft + ColorLeft[GREEN] NewCol[pixelXFromLeft][BLUE] = m[BLUE] * pixelXFromLeft + ColorLeft[BLUE]
There are many mathematical ways to create a transition, and we really want to understand which transition you really want to see. If you want to see the exact transition from the above image, you should look at the color values of this image. I wrote the program back in time to look at such images and display the values there graphically. Here is the output of my program for the above pseudocolor scale.

Based on the graph view, it is more complex than linear, as I said above. The blue component looks mostly linear, red can be emulated linear, but the green color looks more rounded. We could do a mathematical analysis of green to better understand its mathematical function and use it instead. You may find that linear interpolation with an increase in slope between 0 and ~ 70 pixels with a linear decreasing slope after pixel 70 is good enough.
If you look at the bottom of the screen, this program gives some statistics for each color component, such as min, max and average, as well as the number of pixels in width.
trumpetlicks
source share