Gimp-Forum.net
don't .xcf save parasite information? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: don't .xcf save parasite information? (/Thread-don-t-xcf-save-parasite-information)



don't .xcf save parasite information? - trandoductin - 04-06-2017

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?


RE: don't .xcf save parasite information? - Ofnuts - 04-06-2017

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).


RE: don't .xcf save parasite information? - trandoductin - 04-06-2017

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


RE: don't .xcf save parasite information? - Ofnuts - 04-06-2017

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.


RE: don't .xcf save parasite information? - trandoductin - 04-06-2017

Hahahaha so I did sort of..damn it.
Oh well.