Project

General

Profile

exiv2.exe Windows command line - can you include carriage return(s) in a string?

Added by John Cooper about 12 years ago

I want to create a multi-line IPTC caption

This requires embedded <cr>

I have searched the forum and documentation but have not found a method for doing so eg by using \r or #0D in the string.

Is this possible?


Replies (3)

RE: exiv2.exe Windows command line - can you include carriage return(s) in a string? - Added by Andreas Huggel about 12 years ago

Hi John,

Probably not, see issue #572. But if you find a method similar to the one described there for Windows, please let us know.

Andreas

RE: exiv2.exe Windows command line - can you include carriage return(s) in a string? - Added by Robin Mills about 12 years ago

I agree with Andreas. I don't think the DOS cmd shell enables you to pass <lf> in the command line. However the underlying execv(path,argv**) function will pass that byte. So you could write a little helper program 'axeman' to do something like this:

axeman path\to\exiv2.exe arg1 arg2 ...

The axeman would parse arg1 etc and convert the substrings \n to 0x0a before invoking exiv2 with execv(). You could write axeman in C++ or use Perl or Python or anything than lets you call execv().

It's after 11pm in California and I'm too tired to write axeman at the moment. If you need assistance, I'll be happy to write this for you on Saturday afternoon.

I hope that helps.

Robin

RE: exiv2.exe Windows command line - can you include carriage return(s) in a string? - Added by Andreas Huggel about 12 years ago

Hi Robin,

Nice to see you here!

Alternatively you can of course fix exiv2 (the command line tool). It needs to understand a special character (sequence) in the value of the command (eg "\n", maybe you have a better idea) which can be replaced with a newline when the command is parsed, so that something like this would work as expected:

exiv2 -v -M 'set Exif.Image.Model A fancy\nOlympus camera' IMAGE.JPG

I think this only requires a change in one place: the parseLine() function in exiv2.cpp (see near the end of that function - the variable value contains the text of interest. It will probably only get hairy if you also want to cater for some sort of escape character.

Andreas

    (1-3/3)