0

My intention is to assign tags to each image based on the content in the image.For example

enter image description here

This image can be be assigned tags Tulips,Flower etc

So can i assign subject like tulips,flower and so on separated by commas.Will the major software's and websites recognize these tags properly.

  • "Will major software and websites recognize tags in XMP Subject?" is a very different question from "What is the proper formatting of the XMP Subject tag?". Which do you mean? – mattdm Mar 14 at 6:31
  • @mattdm I mean in such scenarios whats the way to assign the tags? – techno Mar 14 at 6:48
4

The interface for a lot of programs with regards to keywords is to show them as a comma separated string. But the important thing to remember is that they are not stored as such. They are stored as individual, separate items, as in @Romeo Ninov XMP example.

To do this in exiftool, you command would be
exiftool -Subject=Tulips -Subject=Flower FILE
Note that this will overwrite any previously existing keywords.

If you wanted to add new keywords without overwriting previous ones, you would add a + sign before the equal
exiftool -Subject+=Tulips -Subject+=Flower FILE

If you write it as your comma separated list, like this:
exiftool -Subject="Tulips,Flower" FILE
then you are writing a single keyword with the value of "Tulips,Flower".

If you find it easier to write it as a comma separated list, then you can add the -sep option. But you must be careful of stray spaces. For example, using -sep "," if you try to write "Tulips,Flower, Yellow" (note space after the comma before Yellow) then you are writing a keyword of (space)Yellow, not Yellow.

Read exiftool FAQ #17 carefully for details about list type tags.

  • This works fine,but does not work when image already has tags. – techno Jun 16 at 14:16
  • Which part does not work? As I mentioned, if it already has tags, then you need to use the += format. Make sure and read the exiftool FAQ 17 completely. It's all covered there. If you have specific examples, you can head over to the exiftool forum and get lots of help there. – StarGeek Jun 16 at 16:55
  • Please see my post here stackoverflow.com/questions/56619438/… – techno Jun 16 at 17:06
  • Will doing the += add new tags if there are no tags ? – techno Jun 16 at 17:06
  • += will add new list type tags even if there were none to start with. For simple string tags tags, you will get an error using += as that is an incorrect usage. Using just the equal sign = will overwrite any previous tags. I cannot comment on your other post as no knowledge of C# or .net. All I can suggest is test directly on the command line, then try to reproduce the same command in your other code. – StarGeek Jun 16 at 18:51
1

Here is how Lightroom write in XMP keywords for file:

  <lr:hierarchicalSubject>
    <rdf:Bag>
     <rdf:li>Edfu</rdf:li>
     <rdf:li>Egypt</rdf:li>
     <rdf:li>ancient</rdf:li>
     <rdf:li>archeology</rdf:li>
     <rdf:li>architecture</rdf:li>
     <rdf:li>building</rdf:li>
     <rdf:li>history</rdf:li>
     <rdf:li>museum</rdf:li>
     <rdf:li>religion</rdf:li>
     <rdf:li>temple</rdf:li>
     <rdf:li>tourism</rdf:li>
     <rdf:li>travel</rdf:li>
    </rdf:Bag>
   </lr:hierarchicalSubject> 

And this is accepted in all major stock agencies (Adobe, GettyImages, Shutterstock) as well as photo sharing or/and selling sites like 500px, Flickr

The command you can use to incorporate this info in image is something like:

exiftool "-xmp<=xmp.xml" image_file
  • thanks for the info.In this case what's the proper way to use exiftool to write this data? – techno Mar 14 at 6:50
  • I edit my answer, adding command line about @techno – Romeo Ninov Mar 14 at 6:52
  • thanks.. but isnt it possible to do this without creating a separate 'xml' file? Just via command line. – techno Mar 14 at 6:54
  • @techno, for sure there is a way. But I do not know how :) – Romeo Ninov Mar 14 at 6:55
  • 1
    @techno, the example in my answer is only part of XMP file. You should use complete one with this part incorporated. – Romeo Ninov Mar 14 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.