Is there a way to import tags from txt files ?

Started by Mathersss, October 02, 2018, 11:01:59 AM

Previous topic - Next topic

Mathersss

I have a lot of images and txt files with the same exact name of the images and they contain the tags

the format of the txt file is like this

Tag1
Tag2
Tag3
etc

Is there a way to embed those tags in the jpg images ? if not, is there a certain format that I need to arrange my txt file tags in order to make this feasible ?

Phil Harvey

You could always do something like this to embed the whole text file as a UserComment:

exiftool "-usercomment<=%d%f.txt" DIR

- 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 ($).

Mathersss

I tried it and it works but is there a way to embed them as tags ? if this is not possible, would adding ";" to the end of each tag help ? like arranging them like this:

Tag1;
Tag2;
Tag3;

Phil Harvey

This would be tricky, but I still don't understand the format of the file.  You need both a tag name and a tag value.  What exactly is "Tag1"?

- 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 ($).

Mathersss

I think this is gonna be hard, that tags are

tags are like this

Series:GOT
Tyrion_Lannister
Jon_Snow
Jaime_Lannister
Bronn_(game_of_thrones)
Green_screen
Winter

Phil Harvey

I think we may be working on different definitions of the word "tag".  ExifTool can write lots of different types of metadata, called "tags", and identified by their tag name (ie. UserComment).

We may have to go back to FAQ 2 and 3 to determine the tag name of the information you want to write.

- 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 ($).

Mathersss

Here's a picture

I want to just copy the content of the txt file and put them into the tag section


Phil Harvey

Again, the problem is to determine the ExifTool tag name for what you want to write.  I had suggested following the instructions in FAQ 3 to determine the tag name by using ExifTool to extract information from a file that already contains this information.

Looking at this helpful post by StarGeek, it seems you have a choice of different possible tags.

Offhand I might suggest a command like this for what is labelled "Tags:" in your screen cap:

exiftool "-subject<=%d%f.txt" -sep " " DIR

This will split the content of the .txt file into separate words and write them as items to XMP:Subject (which according to StarGeek is displayed in the Windows "Tags:" field).

- 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 ($).

Mathersss

I'm really sorry, I didn't catch that

this is all the information

the "tags" are under Subject and also LastKeywordXMP

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\Nill>exiftool -s "E:\PicsNEW\GOT\New folder\2017_GameOfThrones_HBO_2208
17.jpg"
ExifToolVersion                 : 11.10
FileName                        : 2017_GameOfThrones_HBO_220817.jpg
Directory                       : E:/PicsNEW/GOT/New folder
FileSize                        : 281 kB
FileModifyDate                  : 2018:10:02 19:00:10+02:00
FileAccessDate                  : 2018:10:02 18:23:02+02:00
FileCreateDate                  : 2018:10:02 18:21:37+02:00
FilePermissions                 : rw-rw-rw-
FileType                        : JPEG
FileTypeExtension               : jpg
MIMEType                        : image/jpeg
DCTEncodeVersion                : 100
APP14Flags0                     : (none)
APP14Flags1                     : (none)
ColorTransform                  : YCbCr
ExifByteOrder                   : Big-endian (Motorola, MM)
XPKeywords                      : Series:GOT;Tyrion_Lannister;Jon_Snow;Jaime_Lan
nister;Bronn_(game_of_thrones);Green_screen;Wi
Padding                         : (Binary data 2060 bytes, use -b option to extr
act)
Quality                         : 75%
XMPToolkit                      : Adobe XMP Core 5.6-c132 79.159284, 2016/04/19-
13:13:40
CreatorTool                     : Adobe Photoshop CC 2015.5 (Macintosh)
InstanceID                      : xmp.iid:C871BDF97F5311E7BB41B6E100C676FE
DocumentID                      : xmp.did:C871BDFA7F5311E7BB41B6E100C676FE
DerivedFromInstanceID           : xmp.iid:C871BDF77F5311E7BB41B6E100C676FE
DerivedFromDocumentID           : xmp.did:C871BDF87F5311E7BB41B6E100C676FE
Subject                         : Series:GOT, Tyrion_Lannister, Jon_Snow, Jaime_
Lannister, Bronn_(game_of_thrones), Green_screen, Winter
Warning                         : [minor] Fixed incorrect URI for xmlns:Microsof
tPhoto
LastKeywordXMP                  : Series:GOT, Tyrion_Lannister, Jon_Snow, Jaime_
Lannister, Bronn_(game_of_thrones), Green_screen, Winter
ImageWidth                      : 1000
ImageHeight                     : 635
EncodingProcess                 : Baseline DCT, Huffman coding
BitsPerSample                   : 8
ColorComponents                 : 3
YCbCrSubSampling                : YCbCr4:4:4 (1 1)
ImageSize                       : 1000x635
Megapixels                      : 0.635

C:\Users\Nill>


exiftool "-subject<=%d%f.txt" -sep " " DIR

this command works tho, thank you very much, but is there a better recommendation since I didn't give you the information you wanted the first time

Phil Harvey

Writing XMP:Subject is what I would recommend.  (But you don't need to specify "XMP:" in the command because this is ExifTool's preferred Subject tag.)

- 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 ($).

Mathersss

I tried this

exiftool "-XMP:Subject<=%d%f.txt" -sep " " DIR

and everything is also fine

thank you sir, I'm also sorry for being slow


Phil Harvey

...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 ($).