The problem is simple : you initialize the channelNum variable inside the loop (by doing channelNum=(0)).
So, at each iteration of the loop, the channelNum variable is set to (0).
Simply move the initialization of the variable before the loop :
So, at each iteration of the loop, the channelNum variable is set to (0).
Simply move the initialization of the variable before the loop :
Code:
# integer index of channelName
channelNum = (0)
for spline in splinePoints:
layer_copy1 = pdb.gimp_layer_new_from_drawable(layer_copy, image)
pdb.gimp_image_insert_layer(image, layer_copy1, None, 0)
pdb.gimp_drawable_curves_spline(layer_copy1, HISTOGRAM_VALUE, len(spline), spline)
channelName = str(channelNum)
# copy Red channel as:
channelName = pdb.gimp_channel_new_from_component(image, CHANNEL_RED, channelName)
pdb.gimp_image_insert_channel(image, channelName, None, 0)
# increment integer index
channelNum += 1
# remove equalized layer that was used to create masks
pdb.gimp_image_remove_layer(image, layer_copy1)