Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A curiosity
#1
I have written the attached code which works perfectly (to my amazement!), except for the naming of channels. The screenshot shows the layer names which are identical to the channel names. What I was hoping to have was just the numbers 0 to 9.

I have tried: channelName=channelName[-1] and channelName=""+str(channelNum), but the result is always the same.

It is of no great importance, although I am curious to know why this is the case.

david.
Code:
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)            #(image,layer,parent,position)
        
        pdb.gimp_drawable_curves_spline(layer_copy1,HISTOGRAM_VALUE,len(spline),spline)#cycle through splinePoints list at each iteration
        
        channelNum=(0)                                    #integer index for channelName
        channelName=str(channelNum)                            #channelName string from channelNum

        #copy Red channel as:
        channelName = pdb.gimp_channel_new_from_component(image,CHANNEL_RED,channelName)#(image to add channel, component, channel name)
        pdb.gimp_image_insert_channel(image,channelName,None,0)                #(image,channel,parent,position)
        
        channelNum+=1                                    #increment integer index
        
        pdb.gimp_image_remove_layer(image,layer_copy1)                #remove equalized layer that was used to create masks


Attached Files Image(s)
   
Reply


Messages In This Thread
A curiosity - by david - 09-12-2020, 02:18 PM
RE: A curiosity - by tmanni - 09-12-2020, 06:26 PM
RE: A curiosity - by david - 09-12-2020, 08:11 PM

Forum Jump: