ExifTool Forum

ExifTool => Newbies => Topic started by: Mathersss on October 02, 2018, 11:01:59 AM

Title: Is there a way to import tags from txt files ?
Post by: Mathersss on October 02, 2018, 11:01:59 AM
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 ?
Title: Re: Is there a way to import tags from txt files ?
Post by: Phil Harvey on October 02, 2018, 11:13:22 AM
You could always do something like this to embed the whole text file as a UserComment:

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

- Phil
Title: Re: Is there a way to import tags from txt files ?
Post by: Mathersss on October 02, 2018, 11:23:26 AM
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;
Title: Re: Is there a way to import tags from txt files ?
Post by: Phil Harvey on October 02, 2018, 11:30:31 AM
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
Title: Re: Is there a way to import tags from txt files ?
Post by: Mathersss on October 02, 2018, 11:54:01 AM
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
Title: Re: Is there a way to import tags from txt files ?
Post by: Phil Harvey on October 02, 2018, 12:01:54 PM
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 (https://exiftool.org/faq.html#Q2) to determine the tag name of the information you want to write.

- Phil
Title: Re: Is there a way to import tags from txt files ?
Post by: Mathersss on October 02, 2018, 12:33:04 PM
Here's a picture

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

(https://serving.photos.photobox.com/10666479fd107a5a1410d963f14ffb6c5c70cf7df3939899ab9d0ac2b683fd843efaaffa.jpg)
Title: Re: Is there a way to import tags from txt files ?
Post by: Phil Harvey on October 02, 2018, 12:47:28 PM
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 (https://exiftool.org/forum/index.php/topic,6591.msg32875.html#msg32875), 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
Title: Re: Is there a way to import tags from txt files ?
Post by: Mathersss on October 02, 2018, 01:15:46 PM
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
Title: Re: Is there a way to import tags from txt files ?
Post by: Phil Harvey on October 02, 2018, 01:20:25 PM
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
Title: Re: Is there a way to import tags from txt files ?
Post by: Mathersss on October 02, 2018, 01:31:20 PM
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

Title: Re: Is there a way to import tags from txt files ?
Post by: Phil Harvey on October 02, 2018, 01:34:38 PM
Great.  Glad we sorted things out.

- Phil