text output with each RegionPersonDisplayName on one line

Started by Iwonder, May 15, 2024, 06:24:48 AM

Previous topic - Next topic

Iwonder

Hello !
I am sorry to come back again...
I am going to explain the subject :
I have photos with up to 18 RegionPersonDisplayName tags per image.
I'd like a text output showing this :
FileName01 Title RegionPersonDisplayName#1
FileName01 Title RegionPersonDisplayName#2
FileName01 Title RegionPersonDisplayName#3
FileName02 Title RegionPersonDisplayName#1
FileName03 Title RegionPersonDisplayName#1

I can't find out how to get this
Thank you for reading.

French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

Iwonder

maybe there is no best way other than :

exiftool.exe -T -L -listItem 0 -RegionPersonDisplayName -Filename -Title *.jpg > out.txt
exiftool.exe -T -L -listItem 1 -RegionPersonDisplayName -Filename -Title *.jpg >>  out.txt
exiftool.exe -T -L -listItem 2 -RegionPersonDisplayName -Filename -Title *.jpg >> out.txt
...
exiftool.exe -T -L -listItem 18 -RegionPersonDisplayName -Filename -Title *.jpg >> out.txt

and then sorting ?
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

StarGeek

I can't think of a way to do this.  It would probably be easier to split RegionPersonDisplayName in a spreadsheet and then copy/paste the Filename/Title to cover the empty rows.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

How about this?:

exiftool -p my.args DIR > out.txt

with this my.args file:

$filename $title ${regionpersondisplayname;$_=(split /, /)[0]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[1]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[2]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[3]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[4]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[5]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[6]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[7]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[8]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[9]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[10]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[11]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[12]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[13]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[14]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[15]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[16]}
$filename $title ${regionpersondisplayname;$_=(split /, /)[17]}

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

Iwonder

thank you to both of you,
@Phil, I'm not clever enough with exiftool to understand and manage your proposal ^^
my batch seems to work fine, I will keep on using it
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

Iwonder

Hello again,
On my code, I omitted a few needed tags, for simplifying.
Adapting my batch to fit the whole needed tags of this project, I'm hitting a snag...

Along with one RegionPersonDisplayName per line, my friend wants to get the keywords, which are in the -Subject tag.
Unfortunately, as I am using the listItem option, I only get the first keyword :(
is there a way to get the whole Subjetc tag on each line ?
exiftool.exe -T -L -listItem 0 -RegionPersonDisplayName -Filename -Title -Subject *.jpg > out.txt
exiftool.exe -T -L -listItem 1 -RegionPersonDisplayName -Filename -Title -Subject *.jpg >>  out.txt
exiftool.exe -T -L -listItem 2 -RegionPersonDisplayName -Filename -Title -Subject *.jpg >> out.txt
...
exiftool.exe -T -L -listItem 17 -RegionPersonDisplayName -Filename -Title -Subject *.jpg >> out.txt
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

Iwonder

testing your soluce Phil with
exiftool -T -L -p my.args *.jpg > out.txt

${regionpersondisplayname;$_=(split /, /)[0]} $filename $title $subject
 ${regionpersondisplayname;$_=(split /, /)[1]} $filename $title $subject

out.txt contains everything we need, excepting that tags are not separated by tabulations
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

Iwonder

ok I undestood how is composed the output : I changed spaces characters with tabs in the my.args file
As I said previously, I am dumb...
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

StarGeek

Being inexperienced in a subject is not dumb.

It's taken me a literal decade to get to know exiftool as well as I do, and there are still things I don't know or have enough experience in to provide answers for.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Iwonder

there is so much things to understand - I am not a developer - moreover, language is a barrier for me !
As I said, finally I understood how to manage ARGFILE (it's Perl language, is it ?)
Understanding how it fully works, is another kettle of fish...
Then I further tried to reproduce what is working with RegionPersonDisplayName, with my next need : RegionInfoMP (I guess I need in the Argfile "RegionPersonDisplayName" and "RegionRectangle"), but it failed to give me what I need.
What I'd like to get is :
1stpersonName|its 4 rectangles coordinates, then a tab, -Filename
2ndpersonName|its 4 rectangles coordinates, then a tab, -Filename
...
18thpersonName|its 4 rectangles coordinates, then a tab, -Filename

and if there is no name for a rectangle, a dash instead of the name (but preferably no line in the output)

I tried a few things with no success :(
Could someone help me ?
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

Phil Harvey

Quote from: Iwonder on May 19, 2024, 04:02:47 AMAs I said, finally I understood how to manage ARGFILE (it's Perl language, is it ?)

Sorry.  I should have named this file .fmt not .args because it is a print-format file, not an ExifTool argument file.

Read the -p option documentation for more information.

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

Iwonder

thank you Phil, but whatever the file name or the -p documentation, it doesn't help for my problem  :(
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

StarGeek

Quote from: Iwonder on May 19, 2024, 04:02:47 AMAs I said, finally I understood how to manage ARGFILE (it's Perl language, is it ?)

A FMT file for the -p (-printFormat) option can have some Perl code embedded in the tag name, between the curly braces. An ARG file is a list of exiftool options used with the -@ (Argfile) option

Then I further tried to reproduce what is working with RegionPersonDisplayName, with my next need : RegionInfoMP (I guess I need in the Argfile "RegionPersonDisplayName" and "RegionRectangle"), but it failed to give me what I need.
What I'd like to get is :
1stpersonName|its 4 rectangles coordinates, then a tab, -Filename
2ndpersonName|its 4 rectangles coordinates, then a tab, -Filename
...
18thpersonName|its 4 rectangles coordinates, then a tab, -Filename

and if there is no name for a rectangle, a dash instead of the name (but preferably no line in the output)

I tried a few things with no success :([/quote]

What have you actually tried? It helps to show what you tried and the results.

I haven't tested it, but it should be something like
${RegionPersonDisplayName;$_=(split /, /)[0]}|$RegionInfoRegions $Filename
And you would use the -f (-ForcePrint) option to force a hyphen if RegionPersonDisplayName didn't exist.  But if RegionPersonDisplayName did exist, but was empty, that would require something else.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Iwonder

@StarGeek
I tried so many things ! mostly using RegionRectangle, but I never get the 4 coordinates associated with the person name  :(
However $RegionInfoRegions only gives a dash for every line of the output file :(
French newbie
Other work as volunteer : https://btaliercio.wixsite.com/easy-greek-buttons/en

StarGeek

Ooops, yeah, it needs to be RegionRectangle.

On top of that, the whole RegionInfoMP is such a bad format when it comes to the RegionRectangle.

The -sep option is going to be needed because RegionRectangle is four comma separated numbers and then exiftool will separate each entry by a comma. So it requres a rewrite of the FMT file
${RegionPersonDisplayName;$_=(split /##/)[0]}|${RegionRectangle;$_=(split /##/)[0]} $Filename
${RegionPersonDisplayName;$_=(split /##/)[1]}|${RegionRectangle;$_=(split /##/)[1]} $Filename
${RegionPersonDisplayName;$_=(split /##/)[2]}|${RegionRectangle;$_=(split /##/)[2]} $Filename
${RegionPersonDisplayName;$_=(split /##/)[3]}|${RegionRectangle;$_=(split /##/)[3]} $Filename
${RegionPersonDisplayName;$_=(split /##/)[4]}|${RegionRectangle;$_=(split /##/)[4]} $Filename

Using the above format file and -sep ##
C:\>exiftool -sep ## -G1 -a -s -p temp4.txt y:\!temp\Test4.jpg
Indiana Jones|0.7299916, 0.5606775, 0.0913558, 0.1152361 Test4.jpg
Marion Ravenwood|0.6800793, 0.3213397, 0.0537576, 0.0679942 Test4.jpg
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).