Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

gimp-comment parasite in Python

Tue Sep 20, 2022 9:27 pm

I'm writing a Python plugin to help my workflow in creating animated gifs. Basically, it merges the layer groups into single layer frames and incorporates background layers into those layers. I've read that I can add a comment to the give by creating a 'gimp-comment' parasite. What is missing is actually where to attach the parasite. I first tried adding it to the new image I created and it didn't work. I tried adding it globally and it didn't work either.

After running the plug in, I open the new gif file and look at the image properties and go to the comment tab and it is always blank.

Does anyone have a pointer to some code that works for sure on GIMP 2.10.14?

Also, FYI, I do know that pdb.file_gif_save2 takes a URI, which means the filename must start with "file://" in order for exporting to gif. I am able to export just fine, but I would really like to have a comment in the gif that says "Created by XYZ plugin..." or some such.

Re: gimp-comment parasite in Python

Tue Sep 20, 2022 9:48 pm

See if this helps https://gimplearn.net/viewtopic.php?f=3&t=542&p=3742

Re: gimp-comment parasite in Python

Tue Sep 20, 2022 10:24 pm

Yeah, that's pretty much the only thing I found online about this subject and it doesn't work.

I am curious why that poster uses gimp.parasite_attach() instead of pdb.gimp_parasite_attach(). I did try both methods for global and image parasites, and none of the four ways worked.

So, looking further, it seems the call to pdb.file_gif_save2() is the bit not honoring the comment. When I do everything except export to gif, then manually export to gif via the GUI, the comment I added programmatically is added to the gif file.

I wonder if it has to do with the call to gimp.displays_flush(). I'll try adding that, even though I am not displaying the exported gif.

SPOILER ALERT: Just tested and unfortunately flushing does NOT change the outcome.

Re: gimp-comment parasite in Python

Wed Sep 21, 2022 3:30 am

Unfortunately I can only confirm this. Just reported as a bug.
Post a reply