ExifTool Forum

ExifTool => Newbies => Topic started by: wowo on August 13, 2013, 06:43:58 PM

Title: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: wowo on August 13, 2013, 06:43:58 PM
I want to rename my photo files with IPTC Keywords. The original name must not be changed.
My system is Linux (Ubuntu) and I am using Shotwell.

Example:
IPTC Keywords in Metadata: 2013, Kroatië, Novalja, Vakantie
Original name = DSC06974.JPG

Renaming all photo files within directory /home/silencio1/temp with the following code:
exiftool '-filename<%f_$Keywords.%e' /home/silencio1/temp

After renaming = DSC06974_2013, Kroatië, Novalja, Vakantie.JPG

I cannot find out how the "ë" could be renamed correct.

[edit] deleted "-exif=UTF8" from code; was not correct [/edit]
Title: Re: Renaming photo files with IPTC Keywords; Charset problem ë
Post by: Phil Harvey on August 13, 2013, 07:11:59 PM
As long as the IPTC is encoded properly (preferably UTF-8 with CodedCharacterSet set), then your command should work on Mac/Linux (without the -exif=UTF8 which does nothing for many reasons).

What do you see in your terminal with this command?:

exiftool -keywords DSC06974.JPG

If your terminal uses UTF-8 and you see the proper special characters with the output from the above command, then this should work to rename the file:

exiftool '-filename<%f_$Keywords.%e' /home/silencio1/temp

I tried, and it works for me on my Mac.

But i would suggest perhaps adding -sep '_' to the command to use a different separator for the keywords.

- Phil
Title: Re: Renaming photo files with IPTC Keywords; Charset problem ë
Post by: wowo on August 14, 2013, 03:37:54 AM
Sorry, I used the command without -exif=UTF8. The command with -exif=UTF8 did work but gived an warning:
Warning: Invalid EXIF data for EXIF:EXIF

Output exiftool '-filename<%f_$Keywords.%e' /home/silencio1/temp:
exiftool -keywords DSC06974.JPG
Keywords                        : 2013, Kroatië, Novalja, Vakantie

The following did for me the trick:
exiftool -L '-filename<%f_$Keywords.%e' /home/silencio1/temp

After that I insert _ and delete , with pyRenamer. Result:
DSC06974_2013_Kroatië_Novalja_Vakantie.JPG

Thanks for your help.
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: Phil Harvey on August 14, 2013, 07:24:29 AM
Glad the special characters work.  You don't need to use pyRenamer if you use the -sep option I mentioned earlier.

- Phil
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: wowo on August 14, 2013, 06:17:11 PM
Quote from: Phil Harvey on August 14, 2013, 07:24:29 AM
Glad the special characters work.  You don't need to use pyRenamer if you use the -sep option I mentioned earlier.
I do not know how I must use the -sep function in my code. That's why I have used pyRenamer.
I have tried a lot of options with -sep but none of them worked.
Example:
exiftool -L '-filename<%f_$Keywords -sep.%e' /home/silencio1/temp
After renaming:
DSC06974_2013, Kroatië, Novalja, Vakantie -sep.JPG
De separator in Shotwell for multiple keywords is ',' .
Can you maybe tell me how the code must be ?
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: Phil Harvey on August 14, 2013, 08:21:18 PM
The options work like this:

exiftool -L '-filename<%f_$Keywords.%e' -sep '_' /home/silencio1/temp

Read the ExifTool application documentation (https://exiftool.org/exiftool_pod.html) for a full list of options with lots of examples.

- Phil
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: wowo on August 15, 2013, 03:20:29 AM
Thanks for your reply.
One of the options I have tried was also your command. ;)

Unfortunately this command does not work.
The output is the same: DSC06974_2013, Kroatië, Novalja, Vakantie.JPG

I don't mind, I will do the last steps with pyRenamer.
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: Phil Harvey on August 15, 2013, 07:24:28 AM
If the output is the same then either you are using an old version of ExifTool or your keywords are not stored properly, and are stored together in a comma-separated string instead of separately as they should be.  In this case, the following command will work:

exiftool -L '-filename<%f_${Keywords;s/, /_/g}.%e' -sep '_' /home/silencio1/temp

I have left in the -sep option so the above command will work whether or not the Keywords are stored properly.

- Phil
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: wowo on August 15, 2013, 11:11:34 AM
This command is working very strange for me.
1 directories scanned
1 directories created
1 image files updated

A new directory is created with the name "DSC06974_2013, Kroatië, Novalja, Vakantie;s".
In that directory is stored another directory called ",". In that directory another directory with the name "_". In the last directory was the foto file with the renamed name "g}"
::)

These tags are made with Shotwell and are Hierarchical Tags.
Maybe this is why -sep is not working ?
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: Phil Harvey on August 15, 2013, 06:56:59 PM
Update your version of ExifTool, you must be using an old version.  The current version is 9.34.  The behaviour you describe will happen with version 9.14 or earlier.

- Phil
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: wowo on August 16, 2013, 03:30:51 AM
Ah!
I am using Ubuntu 12.04 lts.
It seems indeed that I have an very old version of exftool: 8.60
I will try your command with the correct recent version.
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: wowo on August 16, 2013, 03:48:54 AM
The same behaviours  :'( with version 9.34.
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: wowo on August 16, 2013, 04:08:42 AM
 :)
I have tried everything again in 13.04 Ubuntu running in virtualbox and now it is running well.
Output is DSC06974_2013_Kroatië_Novalja_Vakantie
I must find out myself what goes wrong in Ubuntu 12.04 ....
Again thanks for your help.
Title: Re: [Solved] Renaming photo files with IPTC Keywords; Charset problem ë
Post by: wowo on August 24, 2013, 04:52:19 PM
The commando:
exiftool -L '-filename<%f_$Keywords.%e' -sep '_' /home/silencio1/temp
is now working well in Ubuntu 12.04.
I think that the sytem was using the exiftool from the Hugin Panorama Creator.
After installing exif tool with your instructions, exiftool gave no problems.