07-26-2022, 02:27 PM 
	
	
	
		I have been trying to write a script to automate colour cast removal.
If an image has transparency it "dilutes" the colour cast I am trying to remove.
When I run the following code
I can look in the channels palette and the alpha channel has gone. In the layers palette I can right-click on the layer and it gives me the option to add an alpha channel. However, if I carry out any action, such as adding a layer, the alpha channel re-appears in the channel palette.
I have tried running the code and then doing a "Save as". On loading the saved file, the alpha channel is again in the layers palette.
I created an xcf file where the alpha channel was filled with 50% grey (7f7f7f Hex) in order to test.
   
I put this into general queries as the same occurs when the actions are carried out manually.
Operating system: Ubuntu 20.04
GIMP: 2.10.32
	
	
	
If an image has transparency it "dilutes" the colour cast I am trying to remove.
When I run the following code
Code:
layerClean = pdb.gimp_layer_new_from_drawable(layer, image)                                                    # layer to be cleaned of alpha channel
pdb.gimp_image_insert_layer(image, layerClean, None, 0)                                                        # insert layer
pdb.gimp_image_set_component_visible(image, CHANNEL_ALPHA, FALSE)                                            # make alpha channel non-visible
pdb.gimp_layer_flatten(layer)                                                                                # remove alpha channel
pdb.gimp_image_remove_layer(image, layerClean)I can look in the channels palette and the alpha channel has gone. In the layers palette I can right-click on the layer and it gives me the option to add an alpha channel. However, if I carry out any action, such as adding a layer, the alpha channel re-appears in the channel palette.
I have tried running the code and then doing a "Save as". On loading the saved file, the alpha channel is again in the layers palette.
I created an xcf file where the alpha channel was filled with 50% grey (7f7f7f Hex) in order to test.
I put this into general queries as the same occurs when the actions are carried out manually.
Operating system: Ubuntu 20.04
GIMP: 2.10.32

