pitibalrog wrote:
And this two function returns something like (3 #(55, 32, 25)). If I have only one layer it returns (1 #(55)) and (0 #()) for empty group.
So I think I have to do cadr everytime to get the real list and not the count.
You are correct; I was mistaken. I tend to convert everything to lists and didn't notice that you were processing the "array" of layers (in Scheme parlance, such an array is called a "vector"; not to be confused with GIMP's 'vectors' terminology for paths).
pitibalrog wrote:
Some more questions I have about your code:
1) Where can I find the complete list of possible parasites like "gimp-comment"?
Parasites are user-defined "properties" that can be attached to various GIMP entities. The "gimp-comment" parasite is one of the few that is actually recognized by GIMP (when attached to an image being exported, it will be included as the file comment if supported by the targeted file format).
More generally, parasites provide a good way of associating data with an image, drawable, path, or the GIMP program itself. For example, the GFIG plug-in ("Filters->Render-Gfig") attaches a parasite to the generated layer that permits you to go back later and edit the shapes on the layer. In
this script, I use a parasite so that the user can initially set some defaults for adding a watermark to an image, and then subsequently add that watermark to other images without being prompted.
pitibalrog wrote:
2) Why using file-png-save2 instead of gimp-file-save? I noticed that using the first one don't export layer applying mask. gimp-file-save RUN-WITH-LAST-VALS do it but not RUN-NONINTERACTIVE.
Using the 'file-*-save' plug-ins allows me to explicitly specify the various parameters, rather than having the defaults used (the user may have set the defaults to something suboptimal for my purposes). In this case, the user may have changed his default for PNG files such that the comment is not included.
You are correct that my script fails to account for layermasks; this should need be addressed in a future version. I would probably tend toward saving the mask as a separate file, but you may wish instead to have it applied before saving.
I added the 'gimp-progress-end' at the end of my script just to cleanup the status line; sometimes it will get "stuck" showing the last operation. Generally, progress should be displayed executing 'gimp-progress-update', or at least 'gimp-progress-pulse', within your program's looping code -- I was lazy and did not do this.