Florent Monnier ([EMAIL PROTECTED]) wrote:
> Some months ago someone on a mailing-list asked how he could change 
> the comment of xcf files in order to add licencing informations (such as GPL 
> or creative-commons), so as it seems it's not possible from the GUI (maybe we 
> all failed on this mailing-list to find it) I tryed to write a script to 
> change the comment. I noticed that the byte just before the comment (which 
> resides at the begining of the xcf) was the length of this comment, so I 
> tryed to make a script for that guy which changed the comment, and changed 
> the length byte of it too. But It didn't work.
> http://www.linux-nantes.org/~fmonnier/tmp/comlen.ml.html
> From the specs draft I guess that's because there are offsets before the 
> comment, is it right ?
> (I haven't found for the xcf comment in this draft, perhaps I have missed it?)

The comment is stored as a so-called "parasite", in this case a parasite
of the image (you can also attach parasites to the individual
layers/drawables). The comments parasite name is "gimp-comment".

You can use script-fu to access the content of said parasites, the
problem is, that the format of the data is not very convenient to
process with script fu.

Try this:
- start the gimp
- create a new image, optionally changing the comment
- open the script-fu-console and enter the following command:

=> (gimp-image-parasite-list 1)
(1 ("gimp-comment"))

This tells us that there is one parasite for image no. 1, and it is called

=> (gimp-image-parasite-find 1 "gimp-comment")
(("gimp-comment" 1 #22"437265617465642077697468205468652047494d5000"))

Executing PDB commands via script-fu always returns a list, in this case
the first element of the returned list (the first return value) is the
parasite that is attached, in script-fu it is represented as a list
itself: (name, flags, value). The value is a byte array with in this
case 22 bytes, and you'll notice that the following hex values are the
bytes of the string "Created with the GIMP", which is the comment.

Writing a plugin to change the comment probably is easier than doing
this with script fu or even binary-patching the XCF, the functions in
the PDB allow to do this and this is the route I'd suggest.

I hope this helps,
              [EMAIL PROTECTED]              http://simon.budig.de/
Gimp-developer mailing list

Reply via email to