Tutorial - Reverse Engineering Gradient Mapping in pictures (Krita and G'MIC) - GIMP version request here too

After making the filter named Gradient Map Reverse Engineering, some of you might find yourself not being able to use the filter because you don’t know what to do with the end result. For this tutorial, I will be using Krita 4.3 as a base software to start with.

Using the Gradient Map Reverse Engineering Pictures using Krita

  1. Open Krita 4.3
  2. Have two images. One with black and white picture, and the other with colors. Your Krita should look something like this


This order is ideal.

  1. Go into G’MIC QT by Filter-> Start G’MIC QT
  2. Search with ‘Grad’ and click Gradient Map Reverse Engineering
  3. Use those Settings, and click apply. (It can take a while with big pictures as you’re testing millions of colours and averaging them per values. That means in a image with 2000x4000 colors, you’re testing 8,000,000256 values which means that it checks for 2,048,000,000 colors.Rescale if you must, but you lose precision.)*


Note: The background color should be the inversion of the gradient map color for the easiest way to tell them apart. But, you don’t have to do this.

  1. When the filter is finished, zoom into the top left of the document, you should have something that looks like this.

  1. Crop the area or copy and paste the area into the new document. I choose the second. Though I have to warn you that you may have to select the area outside the gradient within Krita as Krita does autoresize to alpha. You can crop that. Your result should look this:

Checkerboard implies transparency. That grayscale value never existed in the first place.

  1. For lost information on the ends, you can fill in it with white or black. Then apply solidify using G’MIC QT. After doing that, your result should be something like this:

image

  1. Now you’re at a point where you might ask yourself, what am I supposed to do with this. Well, since it’s 256 values that exist, create a new black and white gradient layer. You should have something like this:

  1. Deselect. Now you can start making the filter for those. The easiest, but inaccurate method would be using gradient map. Right click on the black and white gradient, and add filter mask, and then use gradient map. If you’d like more precision, you can always use a color adjustment layer, and then ramp the RGBA curve up. The most accurate method would be using Color Curves, and having another color curves to ramp up differences using difference blending modes, and modifying on channels by channels basis, but this is super slow.

  2. Then, after this select gradient map filter mask, and change it property. Then click and slide and match colors. After a while, you get something like the above.

  1. So, what now? How can I use the non-destructive filter? Well, you can copy and paste layer carrying the filter mask, then move the filter mask into your grayscale image. Your result should be something like this.

The left picture is gradient mapped, and the right picture is original. Note that there’s more vibrancy on the right.

For those who’s wondering, I have taken the picture. You can use it for your own personal project if you want as long as credits are given.


The picture used in this tutorial is here -


Abstract Building - ( CC BY-NC-SA)


Just a little note to mods - If any one posts the GIMP equivalent of this tutorial, I’d be happy for it to be posted here at the start of this thread.

1 Like

I am curious what the application for this is besides making what is essentially a LUT and manipulating its smoothness and accuracy.

There’s graphical user interface development and especially when it comes to game mods. That’s the only other purpose I can think of. It can be used to automate photo editing though. In this case, with Krita, you can slap in some adjustment masks, copy layers with adjustment masks that was created with the aid of this filter, and then slap it in other images you’re using, and you got your UI game mods.