gimp
gimp copied to clipboard
pdb.gimp_image_insert_channel is not working at all in gimp 2.10
Here goes my code to generate new tiff with clipping path. Everything works fine, but the part of inserting a new channel. ...I am trying to add a new channel because the alpha channel goes off when the clipping path gets created. It's a kinky situation and I wasted about 10 days without any luck.
Any suggestions highly appreciated.
def JustAddPath(infile, sRGB, aRGB, pathname, outfile):
image = pdb.gimp_file_load(infile, 'image', run_mode=RUN_NONINTERACTIVE)
layerlist=image.layers
layer = layerlist[0]
if not pdb.gimp_item_is_group(layer):
#Select channel 3 (blue) to create clip with
pdb.gimp_image_select_item(image, 2, layer)
pdb.plug_in_sel2path(image, layer)
#Set name of clipping path
vector_name=pdb.gimp_path_list(image)[1][0]
vec=pdb.gimp_image_get_vectors_by_name(image,vector_name)
vec.name=pathname
#Insert new channel using channel blue- THIS DOES NOT WORK!!!
try:
channel = pdb.gimp_channel_new_from_component(image, 2, "Arbitrary")
pdb.gimp_image_insert_channel(image, channel, 0, 4)
except:
print ("Oops, busted!")
#Define source and target icc profiles
pdb.plug_in_icc_profile_apply(image, sRGB, 0, False)
pdb.plug_in_icc_profile_set(image, aRGB)
#Save to Disk
drawable = pdb.gimp_image_get_active_layer(image) #or simply- layer
pdb.file_tiff_save(image, drawable, outfile, 'image.tif', 0)
Is this issue specific to the Snap package? If not, then better help will be available on the gimp project issue tracker: https://gitlab.gnome.org/GNOME/gimp/-/issues