Normalize a tag to only n characters

Started by vicmarto, February 25, 2019, 11:12:55 PM

Previous topic - Next topic

vicmarto

Hello.

Please, how can I normalize a tag to just the first n characters? I want to do this to the SubSecTimeOriginal tag to get always 2 characters, because now I have photos from cameras who write only 1 character in this tag, other cameras who write 2 characters, and even cameras who write 3 characters.

How can be cut the 3 characters SubSecTimeOriginal tags to just 2? And how to increase the 1 characters SubSecTimeOriginal tags to 2 characters?

Thank you very much in advance.

Phil Harvey

Using the advanced formatting feature:

${subsectimeoriginal;$_=substr($_.'0',0,2)}

But note that this will change "349" to "34".  It would be more difficult if you want values like this to round up.

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

vicmarto