Imort metadata from text file

Status
Not open for further replies.

paulgodard

Member
Joined
Apr 4, 2008
Messages
83
Location
Windhoek, Namibia
Lightroom Experience
Advanced
Lightroom Version
Classic
Along many years I have developed a mysql/php imagebank. Of course it is less powerful than LR. So now I would like to export my data into LR. Most of the data can be imported into the metadata and stored into LR or even rewritten into the dng/psd/tif images metadata.

What is the best way to do this. On my side, I can write any kind of text or xml file from my php/mysql application. Another alternative would be to write directly the data into the image metadata from a php script.

Does anyone has experience in that regards, or some advise to share?
 
You don't want to do anything too complicated then..... :lol: Out of my league I'm afraid!

The LR catalog is SQLite - if you're that comfortable with databases, you could give it a shot writing directly I guess, although I'd definitely work on a duplicate as you could introduce all sorts of problems.

Writing to the image metadata might well be a safer option I guess - I'd love to hear how you get on!
 
Paul I can highly recommend this forum:

http://tech.groups.yahoo.com/group/controlledvocabulary/

It's not completely public, I believe there's a little application/verification process to go thru.

These folks are maestros of metadata, and I'm sure someone there will be able to steer you in the right direction, both technically and philosophically.

There's been a lot of traffic there recently concerning LR.

If you're concerned mostly with keywords, I can help a little. Beyond that, we have a couple of LR metadata gurus here, Mark Sirota comes to mind. He's a very frequent poster, I'm sure he'll be by soon.
 
Thanks for the link, Brad. My membership is pending...

I have looked around but so far I still don't know what is the best and easiest option.

BTW, I have about 4'''' images in my database, so finding the right approach is critical!

Thanks for the help so far. This forum is very good. Thank you Victoria, I think you have rplied to most of my questions so far!
 
Why not write XMP data, then? It's just XML. You can easily deconstruct the format by putting some keywords on an raw file, and writing out the XMP file, and inspecting it with a text or XML editor.
 
Sounds good advise, Mark. Thank you.

Is the XMP file, what is called the sidecar file? Does it contain all the metadata?

How can I create a XMP file that contains all the metadata from LighRoom 1 or 2, in order to examin its structure?

I have written XML files in the past, so this should not be an issue.
 
You've got me interested Mark.... how do you access XMP that's stored within the file, such as the PSD/DNG/Tiff's that Paul will be using?
 
To create an XMP file, import a raw file, add some relevant metadata within Lightroom, then write out the XMP using control/command-S. This will create a file called <filename>.xmp alongside the raw file, which contains the XML-formatted metadata.
 
Hmm -- if Paul is using a file format with XMP embedded (rather than in a sidecar), I'm not sure how he'd integrate.

With a raw file, you'd just put the XMP file in place (same filename, but with .xmp extension, in the same directory as the raw) and do "Read Metadata from File". I don't know whether LR would detect sidecar files for file formats that can hold the XMP, though. Experimentation is needed.

Hopefully he's using raw files...
 
Hmmm, in his initial question Paul mentioned PSD/DNG/Tiff, hence my wondering. It must be possible to do though.... maybe?!?
 
Most of these images are jpg or psd files... unfortunately not raw files.

I tried to write a sidecar xmp together with my dng file, no luck. Is it possible with the dng file, or is it only with camera raw files? Anyway the sidecar xmp is not the solution as I have jpg/psd files.

I will dig out some php script to write the metadata inside the jpg/psd file. I think this is my only viable solution.
 
Most of these images are jpg or psd files... unfortunately not raw files.

I tried to write a sidecar xmp together with my dng file, no luck. Is it possible with the dng file, or is it only with camera raw files? Anyway the sidecar xmp is not the solution as I have jpg/psd files.

I will dig out some php script to write the metadata inside the jpg/psd file. I think this is my only viable solution.
Friedemann Schmidt from Berlin Germany is writing metadata to DNG and JPG but I did not checked for PSD tough. He is doing so with the help of ExifTool in his program to Geotag photos, namely GeoSetter. He gently replied to me on some problems. You may wish to contact him and see if he can give you a hint?...
 
The final reciepe... and it works

For who is interested, here is how I have done it.

I have used the fantastic utility to read/write metadata to any kind of file, developed by Phil Harvey : ExifTool (http://www.sno.phy.queensu.ca/~phil/exiftool/).

After testing the utility that works in the Terminal application on a Mac, finding all the exact names of the EXIF and IPTC tags I wanted to write data into and understanding how to use an external text file, I exported the data from my mysql database (from a php script, which was the easiest part) and ask ExifTool to execute all the commands in the external file for about 2'''' images to update! Done, no error. Of course I made a backup before...

In the Terminal :
exiftool -@ ExifToolLines_All.txt

Content of the ExifToolLines_All.txt :
...
PG_1''498.dng
-Rating=3
-Label=
-DateTimeOriginal=2''2:'9:29 '':'':''
-Location=Gordon's Bay, Mountainside, Cocagne
-State=Western Cape, Helderberg
-Country=South Africa
-Title={Watsonia borbonica} pink watsonia flowers
-Keywords=flower|plant
-overwrite_original_in_place
-execute


... for every image ...

Thank you Phil, Victoria and everyone who pointed me in the right direction!
 
That's great to hear Paul!
 
Status
Not open for further replies.
Back
Top