Thursday, March 21, 2013

New User Interface for Krita Color To Alpha filter

Hi, all!

The comments of the artists about my previous change to the Color To Alpha filter showed that many of them really need it in their daily work! But most of them agreed that the user interface of the filter was still "not good enough" for many of the use cases: you simply couldn't select the exact color which should be made transparent! So now the problem is gone and you have various ways of doing this:

Firstly, when you apply a filter directly to the layer with the Filters->Colors->Color To Alpha... menu item, you can just pick the desired color from the image below the dialog! You should also note that while doing this, you can change the options of the color picking tool in the Tool Options docker, like select the Radius used for calculating the average value or to choose whether to pick from the original layer pixels or from the resulting composed image.

Secondly, you can use the standard KDE Color Dialog where you can select the precise RGB values of the color to remove.

And lastly, you can use the Color Picking Tool provided by the KDE Color Dialog. The advantage of this tool is that you can pick a pixel not from Krita only, but from the entire monitor screen!

Just to show you what is now possible with the filter I took a picture that was filmed for some action film... and made it a bit more peaceful :)

The changes are going to be merged into Krita-master (aka Krita-2.7pre-alpha) in a day or two, since it needs to go through a short review process. If you want to test it right now, you can get the updated version from 'krita-testing-kazakov' branch!

Friday, March 15, 2013

Updated Krita ColorToAlpha filter

Hey! We've just updated our Color to Alpha filter, so it can now be easily used for removing background from scanned sketches! Our algorithm differs from the one used in Gimp: we use CIE deltaE [0] function to calculate the difference between the image and the base color, so it is more flexible and configurable. You can choose to what extent you want to remove the background by changing threshold value.

(original painting by David Revoy)

The filter's algorithm is actually quite simple:

1) Firstly, we calculate the difference between the image pixel and the base color and decrease the pixel's opacity according this difference. The less the difference, the more opacity is decreased. As I already said we use deltaE function to calculate this difference.

2) Secondly, we apply an inverse "composite over" to every pixel. Due to that step, if we put a layer filled with a base color below the filtered image, we will get original image!

[0] -