What kind of image processing was used in the Facebook "Celebrate Pride" filter? I am trying to recreate a filter that Facebook released back in 2015 when gay marriage was legalized in the US.

Unfortunately, that filter no longer works/exists so people are left with only knockoff ones that dont do quite as good as a job. None of them manage to do quite what the actual one did espeically in the red, yellow, and purple stripes.

I am trying to figure out what kind of filter they used to achieve this.

I have tried a bunch of colors with each of the blend modes available in my photo editing software with no luck. Perhaps it is more complicated than just one math equation? Perhaps they processed the background image before putting on the overlay?

I did find in the blog that the algorithm to achieve this was a O(n^2) algorithm but that is about all I know.

Any ideas of what could have caused this?

Below are some reference photos I used to attempt to find a pattern.

Example 1: Mark Zuckerburg (note this isn't exact. I couldn't perfectly recreate the crop they used)



Example 2: Facebook logo with colors pulled out on the right
The top Zuckerberg image looks like you first convert your background Zuckerberg image to grayscale. Then you can add a second layer with the rainbow texture but use the 'Screen' blending mode, this will cause it to colourise the layers beneath it, but in such a way the whites are preserved. You could also try 'Multiply' mode too if the results are too bright.

The second one with the facebook logo looks like alpha blending. This can be done using a default layer in photoshop but setting the layer opacity to some midway value, i'd guess around 75% opacity. In this version the rainbow texture is the background, and the layer contains the 'F' logo.