Transform Image to Pink and Green Color
Lately, a lot of profile pictures in Indonesia have turned pink and green, and the trend has gone viral. People are doing this as a form of protest, but also to show solidarity and empathy with those who are speaking up.
I don’t want to dive into the protest itself, but seeing this trend reminded me of my homeroom teacher and department head back in college. One of the classes they taught was digital imaging, or image processing.
The pink-green effect people are using is actually quite simple. It’s just about changing the RGB (red, green, blue) values of each pixel. Here’s the basic idea:
- Go through each pixel and calculate the average of its RGB values. For example, if r:100, g:60, b:80, then the average is 80. If you set all three channels to that average, the image becomes grayscale.
- Then, split the pixels into two groups. If the average is below 128, make it green (the lower the number, the darker the green). If it’s 128 or higher, make it pink (the higher the number, the brighter the pink).
That’s it! You can even play around with your own ranges to get different styles and make the effect look cooler. Here is the sample if you want to use it



