# Color Adjustment Curve Python API

**URL:** <https://krita-artists.org/t/color-adjustment-curve-python-api/169093>\
**Category:** Plugins Development\
**Created:** [February 19, 2026, 6:40am UTC](https://krita-artists.org/t/color-adjustment-curve-python-api/169093 "2026-02-19T06:40:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![general-avalanche-43](https://krita-artists.org/user_avatar/krita-artists.org/general-avalanche-43/32/112107_2.png) [@general-avalanche-43](https://krita-artists.org/u/general-avalanche-43)\
**Post date:** [March 3, 2026, 4:35pm UTC](https://krita-artists.org/t/color-adjustment-curve-python-api/169093/2 "2026-03-03T16:35:24Z")

</div>

Hope this information is of use.

This first script that will print information about a [`FilterMask`](https://api.kde.org/legacy/krita/html/classFilterMask.html), which is distinct from [`FilterLayer`](https://api.kde.org/legacy/krita/html/classFilterLayer.html). The configuration for both are stored in an [`InfoObject`](https://api.kde.org/legacy/krita/html/classInfoObject.html).

```python
from krita import *

def print_filtermask_properties():
	inst = Krita.instance()
	doc = inst.activeDocument()
	node = doc.activeNode()
	if node.type() != "filtermask": return
	f = node.filter()
	print(f.name())
	cfg = f.configuration()
	print(cfg.properties())

print_filtermask_properties()

```

I created a fresh filtermask and set it to the one called “Color Adjustment”. I then selected the layer and ran the script.

The internal name seems to be `perchannel`.

```plaintext
perchannel
{'curve0': '0,0;1,1;', 'curve1': '0,0;1,1;', 'curve2': '0,0;1,1;', 'curve3': '0,0;1,1;', 'curve4': '0,0;1,1;', 'curve5': '0,0;1,1;', 'curve6': '0,0;1,1;', 'curve7': '0,0;1,1;', 'nTransfers': 8}

```

I added another control point to the curve and ran the script again

```plaintext
perchannel
{'curve0': '0,0;0.253623,0.745098;1,1;', 'curve1': '0,0;1,1;', 'curve2': '0,0;1,1;', 'curve3': '0,0;1,1;', 'curve4': '0,0;1,1;', 'curve5': '0,0;1,1;', 'curve6': '0,0;1,1;', 'curve7': '0,0;1,1;', 'nTransfers': 8}

```

There are 8 channels for adjusting, and it seems `curve0` corresponds to channel “RGBA”.

Before: `'curve0': '0,0;1,1;'`  
After: `'curve0': '0,0;0.253623,0.745098;1,1;`

Pairs of x,y coordinates.

I haven’t checked every single filter to see if it gives all the properties but I feel its safe assume it does.

This next script sets values for an existing filtermask.

```python
from krita import Krita, InfoObject

def msg(msg, duration=500):
    Krita.instance().activeWindow().activeView().showFloatingMessage(msg, Krita.instance().icon("16_light_warning"), duration, 1)

def func():
    inst = Krita.instance()
    doc = inst.activeDocument()
    if not doc: return

    cur_node = doc.activeNode()
    if cur_node.type() != "filtermask":
        msg("need to select filtermask")
        return

    filter_name = "hsvadjustment"
    cur_filter = cur_node.filter()
    if cur_filter.name() != filter_name:
        msg(F"need to use {filter_name} filter")
        return

    props = {'colorize': True, 'compatibilityMode': False, 'h': 150, 's': 50, 'type': 1, 'v': 0}

    new_filter = inst.filter(filter_name)
    new_filter.setName(filter_name)
    cfg = InfoObject()
    cfg.setProperties(props)
    new_filter.setConfiguration(cfg)
    cur_node.setFilter(new_filter)

    doc.refreshProjection()

    print(cur_node.filter().configuration().properties())

func()

```

This final script will add a mask, sets its values, and set its alpha based on a selection.

Like the previous script to get a filter you have to do `Krita.instance().filter(filtername)`.

```python
from PyQt5.QtCore import QTimer
from krita import InfoObject, Selection

def msg(msg, duration=500):
    Krita.instance().activeWindow().activeView().showFloatingMessage(msg, Krita.instance().icon("16_light_warning"), duration, 1)

def func():
	inst = Krita.instance()
	doc = inst.activeDocument()
	node = doc.activeNode()
	if node.type() != "paintlayer":
		msg("need to select paint layer")
		return

	fn = "hsvadjustment"
	msg(f"applying {fn}", 1000)
	f = inst.filter(fn)
	fp = InfoObject()

	props = {'colorize': True, 'compatibilityMode': False, 'h': 150, 's': 50, 'type': 1, 'v': 0}

	fp.setProperties(props)
	f.setConfiguration(fp)

	# mask should use whole document bounds
	fm = doc.createFilterMask(fn, f, doc.rootNode())

	# mask uses the current layer bounds
	# fs = Selection()
	# fs.selectAll(node, 255)
	# fm = doc.createFilterMask(fn, f, fs)

	node.addChildNode(fm, None)

	doc.refreshProjection()

func()

```

---

_[View the full topic](https://krita-artists.org/t/color-adjustment-curve-python-api/169093)._
