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.

  • \$\begingroup\$ "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? \$\endgroup\$
    – mattdm
    Commented Mar 14, 2019 at 6:31
  • \$\begingroup\$ @mattdm I mean in such scenarios whats the way to assign the tags? \$\endgroup\$
    – techno
    Commented Mar 14, 2019 at 6:48

2 Answers 2


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.

  • \$\begingroup\$ This works fine,but does not work when image already has tags. \$\endgroup\$
    – techno
    Commented Jun 16, 2019 at 14:16
  • \$\begingroup\$ 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. \$\endgroup\$
    – StarGeek
    Commented Jun 16, 2019 at 16:55
  • \$\begingroup\$ Please see my post here stackoverflow.com/questions/56619438/… \$\endgroup\$
    – techno
    Commented Jun 16, 2019 at 17:06
  • \$\begingroup\$ Will doing the += add new tags if there are no tags ? \$\endgroup\$
    – techno
    Commented Jun 16, 2019 at 17:06
  • \$\begingroup\$ += 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. \$\endgroup\$
    – StarGeek
    Commented Jun 16, 2019 at 18:51

Here is how Lightroom write in XMP keywords for file:


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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