I'd love a way to "sign" my work with a quick shortcut for both jpg and png files.
Currently I just type something in the comment box when exporting a jpg. It would be nice if you could save your comment as part of setting your save defaults, but it doesn't work that way. This is still much quicker than writing a Title/Author in a png file. For that I have exported what I would like as my defaults and have to do Image > Metadata > Edit Metadata Select: Import Metadata from the drop-down and navigate to my saved file.
So my question is, would it be possible to script this at all to make it a bit quicker and easier?
ie.. script the importing of a default set of metadata.
I counted that it takes me 10 distinct actions to import metadata, which is still quicker than having to write it out each time. I thought it might be quicker to try and script it than to ask for a feature request, as I doubt this would make it high on the priority list. I guess exiftool might be the quickest way for adding it after the fact, but it won't add it to the xcf where is the ideal spot for it.
If someone can thing of a better way I'm all ears.
I found your first post interesting. Unfortunately nothing, so guessing a plugin is not possible (or easy) I do recall a similar question some time back on GimpChat.
Using exif probably the best way to go. I do not have it installed at the moment. Find the syntax a pita, although I once used the exiv2 gui. Any information on ease of use appreciated.
Other possibilities. You can add comments with ImageMagick (IM) The mogrify command writes the file in place. Wildcard for lots of similar format or named single files
Thinking along the lines of a series of 'boiler plate' text files.
Do not try this with a gimp .xcf file it will trash it.
Observations.
jpegs are ok, the comment is written into the file and visible in Gimp example: https://i.imgur.com/KqWFAUJ.jpg
png's are weird. Using Gimp to write the comment and properties it is there and visible. Using IM and the comment vanishes from Gimp but I can see it using XnViewMP https://i.imgur.com/4ybwH2X.jpg
Closest thing to an xcf might be a multi-page tif except text layers and Layer groups are flattened. https://i.imgur.com/YTPqJJI.jpg
For what use it might be, a little plugin (that is all I can ever manage, 'little') comment .py to display the comment. Only saves you one click.
09-25-2020, 09:26 PM (This post was last modified: 09-25-2020, 09:44 PM by akovia.)
(09-25-2020, 09:13 AM)rich2005 Wrote: Using exif probably the best way to go. I do not have it installed at the moment. Find the syntax a pita, although I once used the exiv2 gui. Any information on ease of use appreciated.
Well I only planned to use it in a bash script, (the only scripting I have any experience in) so I'm not real worried about syntax as I only ever need to get it right one.
I've used it before for some things, but not for a while. I did find the link below both informative for using exiftool, and what fields are best to use. https://libre-software.net/edit-metadata-exiftool/
(09-25-2020, 09:13 AM)rich2005 Wrote: Observations.
jpegs are ok, the comment is written into the file and visible in Gimp example: https://i.imgur.com/KqWFAUJ.jpg
png's are weird. Using Gimp to write the comment and properties it is there and visible. Using IM and the comment vanishes from Gimp but I can see it using XnViewMP https://i.imgur.com/4ybwH2X.jpg
Closest thing to an xcf might be a multi-page tif except text layers and Layer groups are flattened. https://i.imgur.com/YTPqJJI.jpg
JPEG's are easy for sure, comparatively. The nice thing is that it at least prompts you on export with a comment box so you can see if it's there or not. It's crazy though that you can't have your default comment that's set in the preferences automatically applied to your default save options. At least they could give you the same button you get in the Image Properties > Comment window where you can just click a button to apply your comment.
PNG's are are weird for sure. I don't really care where the metadata ends up, as longs as it's attached in a somewhat relevant field. It should hitch a ride with the image until someone (or some site) intentionally strips the metadata. I am still an avid user of xnviewmp even though it doesn't play nice with gimp, and is what I used in my testing as well. It shows both jpeg and png comments, so I'm satisfied with that.
(09-25-2020, 09:13 AM)rich2005 Wrote: For what use it might be, a little plugin (that is all I can ever manage, 'little') comment .py to display the comment. Only saves you one click.
Thank you for this, but it doesn't appear to do anything for me. I tried before and after adding a comment but see nothing in in a window, or in the error console. Here is the output of my system console.
Using this on a png file (same with jpeg)
Files has default comment - new comment added using script - png exported - file closed - opened again - comment is there. https://i.imgur.com/6QvhWWr.mp4
Same procedure but using xcf format. The comment is not saved (or is it lost when the xcf is reopened?) Whichever way the comment has gone. https://i.imgur.com/QhoiZ67.mp4
Using this on a png file (same with jpeg)
Files has default comment - new comment added using script - png exported - file closed - opened again - comment is there. https://i.imgur.com/6QvhWWr.mp4
Same procedure but using xcf format. The comment is not saved (or is it lost when the xcf is reopened?) Whichever way the comment has gone. https://i.imgur.com/QhoiZ67.mp4
A diagonal look across the source code hints that the 2nd argument is a parasite "type", and a collection of C constants related to Gimp parasites says #define GIMP_PARASITE_PERSISTENT 1|, and indeed, using 1 instead of 0 seems to make the parasite survive in a saved XCF.
Code:
p=gimp.Parasite('gimp-comment',1,'(C) Ofnuts from python-fu')
image.parasite_attach(p)