Replacing some of the characters

Started by Newsky, March 06, 2016, 02:45:28 AM

Previous topic - Next topic

Newsky

Is it possible to replace some of the characters on the other?
It should be in all the photos arranged in subfolders, only to rewrite certain characters in certain fields (-xpcomment; -xmp-dc:description; Comment; imagedescription; IPTC:Caption-Abstract) "and" replacing it with a Cyrillic "и". Is that possible? If possible, how to do it?

There are as follows:


It must be like this:


Thank you!
Sorry for my english. I use Google translator

Phil Harvey

This is possible using a number of different techniques.  You may either create user-defined tags or use the advanced-formatting feature when copying to change the values of individual tags.  But to change the values of a number of tags, maybe the -filter option would be easiest, with a command something like this:

exiftool -tagsfromfile @ -filter "s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription 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 ($).

Newsky

something does not work:
Microsoft Windows [Version 6.1.7601]
(c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.

e:\>chcp 65001
Active code page: 65001

e:\>c:\ExifToolGUI\exiftool.exe -filter "s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription "2016-02-28 12-10-18.jpg" -k
File not found: s/ and / � /g
======== 2016-02-28 12-10-18.jpg
XP Comment                      : На фото: Персона1 (12) and Персона2 (8) Место съёмки: Россия, г. Москва, Москва, Перегон Люблино-Братиславская. 28 февраля 2016 г.
осква, Перегон Люблино-Братиславская. 28 февраля 2016 г.
вская. 28 февраля 2016 г.
я 2016 г.

Caption-Abstract                : На фото: Персона1 (12) and Персона2 (8) Место съёмки: Россия, г. Москва, Москва, Перегон Люблино-Братиславская. 28 февраля 2016 г.
осква, Перегон Люблино-Братиславская. 28 февраля 2016 г.
вская. 28 февраля 2016 г.
я 2016 г.

Description                     : На фото: Персона1 (12) and Персона2 (8) Место съёмки: Россия, г. Москва, Москва, Перегон Люблино-Братиславская. 28 февраля 2016 г.
осква, Перегон Люблино-Братиславская. 28 февраля 2016 г.
вская. 28 февраля 2016 г.
я 2016 г.

Image Description               : На фото: Персона1 (12) and Персона2 (8) Место съёмки: Россия, г. Москва, Москва, Перегон Люблино-Братиславская. 28 февраля 2016 г.
осква, Перегон Люблино-Братиславская. 28 февраля 2016 г.
вская. 28 февраля 2016 г.
я 2016 г.

    1 image files read
    1 files could not be read
-- press RETURN --
Sorry for my english. I use Google translator

Phil Harvey

Try updating to the current version of ExifTool.

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

Newsky

I always follow the Exiftool updates and always use only the latest versions of the Exiftool :) ver.10.12
Sorry for my english. I use Google translator

Phil Harvey

Oh, right.  Sorry.  That is an API option:

exiftool -tagsfromfile @ -api "filter=s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription 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 ($).

Newsky

Hooray! almost got it! If I use Exiftool GUI and insert code:
-tagsfromfile @ -api "filter=s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription
all works!
But if I use the command line turns out here that:
Microsoft Windows [Version 6.1.7601]
(c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.

e:\>chcp 65001
Active code page: 65001

e:\>c:\ExifToolGUI\exiftool.exe @ -api "filter=s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription "2016-02-28 12-10-18.jpg" -k
File not found: @
======== 2016-02-28 12-10-18.jpg
XP Comment                      : На фото: Персона1 (12) � Персона2 (8) Место съёмки: Россия, г. Москва, Москва, Перегон Люблино-Братиславская. 28 февраля 2016 г.
осква, Перегон Люблино-Братиславская. 28 февраля 2016 г.
вская. 28 февраля 2016 г.
я 2016 г.

Caption-Abstract                : На фото: Персона1 (12) � Персона2 (8) Место съёмки: Россия, г. Москва, Москва, Перегон Люблино-Братиславская. 28 февраля 2016 г.
осква, Перегон Люблино-Братиславская. 28 февраля 2016 г.
вская. 28 февраля 2016 г.
я 2016 г.

Description                     : На фото: Персона1 (12) � Персона2 (8) Место съёмки: Россия, г. Москва, Москва, Перегон Люблино-Братиславская. 28 февраля 2016 г.
осква, Перегон Люблино-Братиславская. 28 февраля 2016 г.
вская. 28 февраля 2016 г.
я 2016 г.

Image Description               : На фото: Персона1 (12) � Персона2 (8) Место съёмки: Россия, г. Москва, Москва, Перегон Люблино-Братиславская. 28 февраля 2016 г.
осква, Перегон Люблино-Братиславская. 28 февраля 2016 г.
вская. 28 февраля 2016 г.
я 2016 г.

    1 image files read
    1 files could not be read
-- press RETURN --
Sorry for my english. I use Google translator

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

Newsky

I'm sorry for my inattention

Now I get here are the results:

1. Exiftool GUI: -tagsfromfile @ -api "filter=s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription



All perfectly!

2. cmd: c:\ExifToolGUI\exiftool.exe -tagsfromfile @ -api "filter=s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription "2016-02-28 12-10-18.jpg" -k





3. cmd: c:\ExifToolGUI\exiftool.exe -charset Cyrillic -tagsfromfile @ -api "filter=s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription "2016-02-28 12-10-18.jpg" -k



Sorry for my english. I use Google translator

Phil Harvey

I thought maybe I should have mentioned this.  Try reading FAQ 10 and 18 for some help with special characters on the command line.

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

Newsky

I think I understand. With this syntax, all turned:
c:\ExifToolGUI\exiftool.exe -charset Cyrillic -charset exif=UTF8 -tagsfromfile @ -api "filter=s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription "2016-02-28 12-10-18.jpg" -k

Little question if I may. What type of value -comment That this is the field I did not do it. In it still turns unreadable characters.
Sorry for my english. I use Google translator

Phil Harvey

From the FAQ:

JPEG Comment: The encoding for the JPEG Comment (COM segment) is not specified, so ExifTool reads/writes this text without conversion.

So you need to specify Comment in the character set that you want written.

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

Newsky

#12
I stopped in this version:
c:\ExifToolGUI\exiftool.exe -r -m -charset Cyrillic -charset exif=UTF8 -tagsfromfile @ -api "filter=s/ and / и /g" -xpcomment -caption-abstract -description -imagedescription "E:\test" -overwrite_original -execute "-XPComment>Comment" "E:\test" -overwrite_original -k

Figure out how to explicitly specify the character set for the field could not -comment :) Thank you for your help, Phil! And I'm sorry to interrupt with such things, I'm just very difficult to understand the FAQ without knowing the language, it's my big problem :(
Sorry for my english. I use Google translator

Newsky

#13
Many of the photos, for some strange reason I have remained unchanged. (What could be wrong with them? Attached problematic one of the problematic picture).

How you can add more values to replace? For example:
and = и
months = месяцев
weeks = недель
days = дней
Sorry for my english. I use Google translator

Phil Harvey

Thanks for this report, and for the sample image.  I am able to reproduce this problem.  There is a bug in ExifTool that causes the filter to be ignored for some tags when the Composite tags are being generated.  Until I fix this bug, the work-around is to add -e to your command, which bypasses the Composite tags (which you aren't using anyway in your commands).

To replace more strings, use a filter like this:  s/ and / и /g; s/ months / месяцев /g

You can add as many as you want, separated by semicolons.

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