Gradient Map Filter

July 15, 2024

A web app for applying customizable gradient map filters to photos.

Overview

I made a web app that lets users apply customizable filters to their photos using a gradient map, similar to the gradient map adjustment layer in Photoshop. You can try the app here and check out the GitHub repo for this project here.

A demo of the app

What is a gradient map?

A gradient map is used to map the colors in an image to the colors of a given gradient according to their brightness. Taking a black to white gradient as an example, the darker parts of the image are mapped to dark grey and black, while the lighter parts of the image are mapped to light grey and white. This turns your image into a greyscale image!

Image demonstrating how gradient maps work

Another way of thinking about it is this: suppose your image was converted to black and white. Then, the black in the image becomes the leftmost color in your custom gradient (a purplish-grey in this case), and the white in the image becomes the rightmost color in the gradient (a cream color in this case).

Numerous digital art programs have this functionality, including Photoshop and Clip Studio Paint. Gradient maps are great for changing the mood and atmosphere of a photo. You can also use gradient maps to create cool duotone effects!

If you want to learn more about gradient maps, check out this guide!

Using the app

TL;DR: Upload a pic, choose a gradient, and customize to your heart’s desire!

Tutorial Part 1

Tutorial Part 2

To upload your own image to apply a filter to, click on the “Choose file” button and pick an image.

The web app includes 6 default gradients which can be freely customized. Switch between these 6 gradients by clicking on the gradient swatches on the side of the screen. To change a color in the gradient, scroll to the “Custom Gradient” section. Click on a color swatch above the gradient bar and choose a new color using the color picker.

To add or remove a color from the gradient, click on the buttons “Add Color” or “Remove Color”. Colors are added and removed starting from the rightmost color. Note that each gradient needs to have a minimum of 2 colors.

If the filter feels too vibrant or sharp, you can tone down the effect by reducing the opacity of the gradient map. You can do so by adjusting the opacity slider above the “Add Color” and “Remove Color” buttons. I personally recommend lowering the opacity to around 0.3 for a more natural effect.

Once you’re satisfied with the end result, click “Download” to save your new image! You can pick between saving the image as a png or an svg.

Final thoughts

Surprisingly, trying to make this app user-friendly was harder than actually implementing the filter. Most people unfamiliar with photo-editing or digital art probably don’t know what gradient maps are, so making my app as accessible and easy to understand as possible was a challenge. I’m really glad I didn’t give up though - I think the end result is pretty cool!