Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
don't .xcf save parasite information?
#1
I tried setting image parasite
using this in one script

Code:
parasite = gimp.Parasite("gimp-comment",0,comments)
image.parasite_attach(parasite)
and this in another script

Code:
comment = image.parasite_find("gimp-comment")
pdb.gimp_message(comment)
Everything seems to work okay as long as i have the .xcf opened.
If i close the .xcf after first script
and reopen .xcf the 2nd script fails getting parasite.
But when i tested exporting as .jpg
then the 2nd script would work
It seems as though parasite is not being saved when you save .xcf but does save if you export to .jpg.

Any ideas? on how to make it work for .xcf as well?
Reply
#2
You have to use a "persistent" parasite by setting the parasite flag to 1. This works for me:

Code:
➤> image=gimp.image_list()[0]
➤> p=gimp.Parasite("test-parasite",1,"Parasite data")
➤> image.parasite_attach(p)
# Save and close image
# Reopen image
➤> image=gimp.image_list()[0]
➤> image.parasite_list()
('test-parasite',)
➤> image.parasite_find("test-parasite").data
'Parasite data'

I assume "gimp-comment" is a special parasite which is used to set the image comments in formats that support comments, which is why you see it saved for Jpeg and PNG (IMHO this is a bug if the parasite wasn't persistent).
Reply
#3
Thank you so much ofnuts,
I would have never figured that out I don't even know where these flags are mentioned.

Well now my script(s) for Fran6 works fine. https://gimplearn.net/viewtopic.php?t=543&p=3743#p3743
Reply
#4
I'm afraid you have just duplicated Image>Image properties [Alt-Enter] "Comments" tab. "Those who don't know history are destined to repeat it." and those who haven't read the Gimp documentation are destined to rewrite it.
Reply
#5
Hahahaha so I did sort of..damn it.
Oh well.
Reply


Forum Jump: