According to the docs I can access image channels via channels
property but this gives me an empty list. I suspect only user-created channels are accessible via this property. How do I get a channel object for the R, G and B channels?
def python_myscript(img, drawable):
print img.channels
>>> []
I need these channels to apply levels. I wanted to use presets but python-fu can't access these. That means I need to apply the level changes channel-by-channel, eg:
pdb.gimp_drawable_levels(layer, <CHANNEL NEEDED HERE>, ...)
I found there are channel constants. They don't give me an error but the result is "too white" and doesn't seem to matter which constant I use.
pdb.gimp_drawable_levels(layer, RED_CHANNEL, 0, 0.567, False, 1, 0, 1, False)
It seems like the channel constants aren't appropriate to this usage. I looked at the procedure browser and the channel red actually maps to the integer 1 (HISTOGRAM-RED)
So to modify red channel levels
pdb.gimp_drawable_levels(layer, 1, 0, 0.567, False, 1, 0, 1, False)