Main Menu

Question to NoDups

Started by herb, July 11, 2018, 10:11:12 AM

Previous topic - Next topic

Phil Harvey

Hi Herb,

Version 11.08 is out now.  Hopefully this fixes all of the "#[CSTR]" issues.

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

herb

Hello Phil, hello StarGeek,

@Phil:
Thanks for the new version of Exiftool. #[CSTR] works fine sending strings via pipe.

@Phil and StarGeek:
Thanks again for the hint to use -api "Filter=RepNL($_)" in order to get infos about newline.
I tried to use the filter option inside a .exiftool_config file. This does also modify values when I copy them e.g. from *.jpg image into a *.xmp sidecar file.

So my question is: when does this filter option come into effect.
The description in options for the PerlLibrary is not clear to me.

Thanks for your help in advance.
Best regards
Herb

StarGeek

Quote from: herb on August 04, 2018, 12:42:15 PM
This does also modify values when I copy them e.g. from *.jpg image into a *.xmp sidecar file.

Are you saying that it is replacing newlines even when you don't use the -api "Filter=... option?  It shouldn't do that.

QuoteSo my question is: when does this filter option come into effect.

If you add -api "filter...", it will affect all tags you extract.  From the api options:
"Perl expression used to filter all returned tag values" (emphasis mine)

If you need to turn it off, you can by adding the hashtag # to the end of any tag you don't want to process. So, for example, you want to use the RepNL function on Description, but also want to compare it to the original, not filtered version, you can use:
exiftool -api "Filter=RepNL($_)" -Description -Description# File.
which would give you something like this:
C:\Programs\My_Stuff>exiftool -g1 -a -s -api "Filter=RepNL($_)" -Description -Description# y:\!temp\Test3.jpg
---- XMP-dc ----
Description                     : NL:\n CR:\r Tab:\t
Description                     : NL:. CR:. Tab:.


If you're copying tags and you only want one or two to be affected, then you can use the function in advanced formatting rather than using it in filter.  For example, here Description will be affected by RepNL, but any other tag will not.

exiftool -TagsFromFile image.jpg "-Description<${Description;RepNL($_)}" -DateTimeOriginal -OtherTag -AnotherTag image.xmp
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

herb

Hello StarGeek,

thanks for your quick reply and thanks for the detailed explanation.
Now I understand, how filter is working.

Just to clarify:
QuoteAre you saying that it is replacing newlines even when you don't use the -api "Filter=... option?  It shouldn't do that.
Newlines were replaced only when -api "Filter=..." was used.

Best regards
Herb

herb

Hello StarGeek, hello Phil,

@StarGeek:
Just an additional short comment on sub RepNL. This function should also escape existing backslash.

@Phil and StarGeek:
When I write a multiline text into a tag, which "newline" character(s) should be used: CRLF, only LF or only CR.
Should I use that one depending on the operating system: e.g CRLF on Windows.
Or is there a standard which defines it?

Thanks for your comments in advance
Best regards
Herb

StarGeek

Quote from: herb on August 05, 2018, 06:34:24 AM
Just an additional short comment on sub RepNL. This function should also escape existing backslash.

I don't have time to test it right now, but try add this line
"\\" => "\\\\",
right above the one with \n  Test it out first.

QuoteWhen I write a multiline text into a tag, which "newline" character(s) should be used: CRLF, only LF or only CR.
Should I use that one depending on the operating system: e.g CRLF on Windows.
Or is there a standard which defines it?

I haven't seen any standard that defines what should be used, not that I've gone searching, though.  Myself, I only use LF and actually change CRLF to LF in any file that I acquire as part of my preprocessing.  Never had a problem.  I don't think any modern software is going to have a problem with the difference.  Even windows will display just line feeds properly, try printing out a multiline tag with the -b option and see.

I will mention that Lightroom 4.4 (don't know about later versions) would do something odd when writing multiline text in the Caption-Abstract and Description fields.  It would write CR for one tag and LF for the other (can't remember which it wrote for which tag). 

It comes down to what software you use and if it has problems with one or the other.  And it can always be changed pretty easily with exiftool later on if you do find you have problems.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

herb

Hello StarGeek,

thanks again for the detailed answer to my annoying questions.
It is very helpful.

Best regards
Herb

StarGeek

Quote from: herb on August 05, 2018, 02:22:42 PM
thanks again for the detailed answer to my annoying questions.
It is very helpful.

Not annoying at all.  They get me to think about new ways of using exiftool and get my thoughts on various aspects of image metadata out there.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype