Importing metadata from a txt file

Started by capitalcitywriter, May 23, 2010, 08:18:06 AM

Previous topic - Next topic

capitalcitywriter

Hi

I can use exifToolGUI to create a single txt file with selected metadata, say the ITPC tags.

One file i created looked like this:

---- File ----
FileName                        : 0180 1919 Brian (4).jpg
---- IPTC ----
Caption-Abstract             : Brian 004 Gordon Black. c1919 - "Gordon when 7 years old – 1919 – Do you think that he and Paul are alike?"

which looks disarmingly simple, which i like a lot!

Now, i added the following few lines in the same format:

---- File ----
FileName                        : p1070307.jpg
---- IPTC ----
Caption-Abstract             : The quick fat cat sat on the mat

and went back to the GUI, selected my files and hit Export/Import, expecting to see "Import from a single file". I was bitterly disappointed not to find such a facility.

Will such a thing be possible in the future, or have i missed something. The command line version may well do it but i can't figure it out.

Best Regards
CapitalCityWriter

Phil Harvey

Even the command-line version can not import text files in this format.

The only general text-based format that can be imported by ExifTool is XML.  The command lines are:

Export:
exiftool -X FILE

Import:
exiftool -tagsfromfile FILE DSTFILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

capitalcitywriter

Phil

Thanks for the prompt reply. It is disappointing news as there seems to be a groundswell of people who would like to be able to do this. I found my way here from the Picasa help area where a Don Lind has come to the same conclusion.

Is there a technical difficulty in writing code to import metadata?

Cheers,
CapitalCityWriter

Phil Harvey

Quote from: capitalcitywriter on May 23, 2010, 05:11:06 PM
Is there a technical difficulty in writing code to import metadata?

Not really.  It is actually very easy to use the API to import the format you specified.  The trouble is that exiftool exports files in so many possible formats and there is no way I can support them all for import.  (Also, many give descriptions instead of tag names, and many don't give group names or give the wrong groups so import of these wouldn't give you exactly what you exported.  But importing -s -G1 or -s -g1 should be possible.  I'll think about adding this feature.)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

BogdanH

Hi,

Quote from: capitalcitywriter on May 23, 2010, 08:18:06 AM

...and went back to the GUI, selected my files and hit Export/Import, expecting to see "Import from a single file". I was bitterly disappointed not to find such a facility.
....
-sorry to hear that.. but from what you've described (if I understood correctly): You exported metadata to txt file, so you could edit metadata easier inside txt?
As said, maybe I missed the point, but isn't it easier to select all needed files inside GUI and simply insert/modify (IPTC) data by using "Edit ^IPTC" button?

Bogdan

capitalcitywriter

#5
Hi Bogdan

Thanks for reply. To restate the problem, which appears to be similar to that of many others in the various forums:

I have 850 B&W and colour slides from my parents. Naturally, the sensible thing to do is to scan them into a collection of digital images. I want to put these together in some meaningful arrangement with captions that identify the who, what/why, when and where of the photos. This I can then arrange by year, place and why to give a pictorial history of my family. I can then leave my children and their children a precious treasure trove of family history data in the form of slide shows, movies, even printed form, but in a modern media that will last "forever" ie digital images with embedded codes.

I started out by creating a Word document with the following format: Filename. Who. What/Why. Where. When. Why Word? Well when i started the mammoth task I wasn't sure what i was going to do with them; there are so many photo management packages around I assumed (wrongly) that a common text file would be suitable as input to one or more of them. I was wrong. Each of them are so self centred that they think that their format is the only one that anyone will ever need and that everyone in the world is happy to enter metadata information, one image at a time using their tool. Wrong. The closest I came to any sort of easy / speedy way was to use Picasa Web Albums. Here you can edit the captions in a list, displayed 50 at a time. By having the Picasa list on the left of my screen and the Word document on the right, it was reasonably fast to copy and paste the individual entries, almost in bulk if you like.

I, and with all my thanks to Phil and apologies in advance, found ExifTool and thought it was the one, but to be perfectly honest, the user interface isn't for me. Now, your GUI popped up and I was in heaven and we all owe you a big THANK YOU. It's fantastic...up to a point. I exported the exif info to an external text file only to see what the format of the file was, thinking that if one prepared a file in the right format then it could be read back in by the same product and applied to the images/filenames as listed in the file. To create such a file from a Word document with Excel on the side is quite doable. It would be even more doable if that file followed a common format, designed with its creation in mind. The point is that while we have Exif and IPTC and XMP etcetc, which are all standards for the exchange of information between proprietary device and software application, we don't have a standard for the exchange of that information between the proprietary model. I envisage the intermediate txt file being to the image world what RFT files were to the textual world - a common format for the exchange of information. One thing we know from history is that computer applications all have their day in the sun, the IT world is littered with them, and despite the best intentions of vendors to lock the individual into their product, we are a capricious bunch and prefer to be able to move around. Having the ability to export and import just makes it easier.

Initially, we are only talking about one field, a caption. I believe that in XMF it's called Description and in IPTC it's called Content. If your program could be pointed at a directory full of files and then an Import file, it should be easy enough to parse deciding on the fly if its IPTC or XMP, if the file was in the following format:

filename <delimiter> Description|Caption <delimiter> free text up to the maximum character limit if there is one

Now that would be something and the 'net would light up singing your praises!

I would be delighted to work with you on this, giving as much time and effort as required, it's that important. I have the facility of Ant Renamer in mind (its a tool for renaming files names) which gives you a preview screen; file names in the directory listed on the left, the result of applying the input file on the right. When you're happy, you press GO!

Cheers,
CapitalCityWriter

BogdanH

Hi,

I must say, you've described the "situation", as it is right now, very well. This also gives me some insight on metadata workflow some users decide to manage.

Now, let's see if we can find reasonable solution for your case...

Quote from: capitalcitywriter on May 24, 2010, 06:43:11 PM
...
Initially, we are only talking about one field, a caption. I believe that in XMF it's called Description and in IPTC it's called Content. If your program could be pointed at a directory full of files and then an Import file, it should be easy enough to parse deciding on the fly if its IPTC or XMP, if the file was in the following format:

filename <delimiter> Description|Caption <delimiter> free text up to the maximum character limit if there is one

Now that would be something...

Let me recapitalize: you would convert (copy/paste, whatever) data from Word document into simple txt file. Meaning, this txt file would contain metadata values for many image file residing in common folder. Example of txt content:

[XMP:Description]
Filename1.jpg#Whole familiy was there
Filename2.jpg#Neighbour repairing his boat
Filename3.jpg#It was very hot at that day, but it was worth.
...


or

Filename1.jpg#XMP:Title=Birthday#XMP:Description=Whole family was there
Filename2.jpg#XMP:Title=Hobby#XMP:Description=Neighbour repairing his boat
Filename3.jpg#XMP:Title=Garden#XMP:Description=It was very hot at that day, but it was worth.
...


or

[XMP:Title#XMP:Description]
Filename1.jpg#BirthDay#Whole family was there
Filename2.jpg#Hobby#Neighbour repairing his boat
Filename3.jpg#Garden#It was very hot at that day, but it was worth.
...


-if that (or very similar) is the case, then I'm quite sure, it can be done in GUI.

What do you think Phil? I ask, because I assume, any Pearl/script solution would be faster than separate call to Exiftool for each file from GUI. And, I've learned... you allways seems to have some simple solution by hand  :)

Bogdan

Phil Harvey

Hi Bogdan,

I don't have any simple solutions because there are so many possible formats that people use for the text files.  It is simple to write a script to read any sort of these formats, but to write something in advance that would handle all cases is very difficult.

Of course, writing a bit of Perl and using the API is a bit advanced for most users, but here is one example:

https://exiftool.org/forum/index.php/topic,2472.0.html

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

capitalcitywriter

Phil

I can't begin to appreciate the amount of work you have done and the collective knowledge you must have on this subject. ExifTool has even made it into Wikipedia... It's like a rash all over the internet!

In my naive approach, I simply want to add comments to JPG files in bulk, not by opening each photo up in a given tool, editing the field and closing the photo.

I concede that there are many file types outside of JPG and that people might want to import into these besides JPG. I also can see that there are a number of 'standards' such as XML and IPTC and even more 'standards' used by the seemingly infinite number of photo manipulation applications.

So, thanks for your efforts and concern,
CapitalCityWriter