10-08-2024, 07:47 PM
(10-08-2024, 07:29 PM)ttt Wrote: I played around with this and notice the function file_fits_load returns one image but it creates 3 in memory which you can use compose them as RGB.
So i got this to work
def afittest(image,layer,file):
image = pdb.file_fits_load(file,file)
#images set in memory but not returned because return only one but we have 3 new images
l = gimp.image_list()
redImage = l[len(l)-2]
greenImage = l[len(l)-3]
blueImage = l[len(l)-4]
#compose them
new_image = pdb.plug_in_compose(redImage,layer,greenImage,blueImage,redImage,"RGB")
pdb.gimp_display_new(new_image)
In Python you can use negative indexes to access list elements from the end: l[-1] is the last element, for instance. You can even use slices, so for instance: imgR,imgG,imgB=gimp.image_list()[-4:-1].
Otherwise, yes, the Images dockable dialog is your best friend, because it shows all images, even those that have no associated view/display, and there is even a button to create a view for the latter. It is also a nice way to check for lingering images after a script.