Sunset Gradients

Home

Creating gradients from sunsets
Medium: Javascript

sunset gradient
Gradient #4

sunset gradient
Gradient #1

How it works

sunset gradient
1) Find a nice photo of a sunset, or even better, take one yourself.

sunset gradient
2) The aim here is to find the sun in the image. A good place to start is to extract a mask of only the brightest pixels, which is a bit messy but does remove a lot of the non-sun regions.

sunset gradient
3) The noisy bits can be removed using an 'erode' operation, which removes small regions from the mask.

sunset gradient
4) The sun can now be located at the center of the remaining white pixels in the mask.

sunset gradient
5) Finally, all the pixels in the column that the sun is in are extruded along the x axis to form the gradient.

sunset gradient
Gradient #5

sunset gradient
Gradient #6

sunset gradient
Gradient #7