Invoking exiftool.exe programmatically

Started by JMac, September 06, 2010, 09:59:54 AM

Previous topic - Next topic

JMac

Hi Phil,
I am looking at developing a small Windows Forms app to do some "housekeeping" on my image metadata.  Using EXIFTOOL.EXE as the engine to read / write the metadata is almost a great solution for me (I'm working in c#/.NET, and using the PERL library is beyond my abilities!).  The issue I have is that it will be very "expensive" to launch exiftool for each file I wan't to process, and using the directory mode doesn't fit my need.  What would be great is if there was a way to invoke exiftool with a list of files and matching of command lines, if that makes sense.

Any thoughts?  exiftool has so many options I may be missing some that is already there.

Michal

Hi,
I'm sure Phil will give you the best answer but have you looked at the -execute option? It will allow you to join multiple commands in one command line. Also, have a look at the -@ ARGFILE option to load arguments from a separate file: https://exiftool.org/exiftool_pod.html#option_summary

Phil Harvey

I would have suggested the -@ option as Michal has already done (thanks!).

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

JMac

Perfect... Probably should have read more the first time.  Thanks to both of you for your help!

Abedellatif

Hello,
I am trying to invoke exiftool from within a C# application to edit some EXIF tags by calling the command line exiftool from a new process. tThe tool get invoked correctly but never finish, when I check the Task Manager, in the detail pan, I can see 2 exiftool processes.
1- exiftool.exe with a description of "Read and Write meta information" located in my application folder.
2- exiftool.exe with a description of "exiftool.exe" located in the par-<username> folder.
When checking the  analyze wait chain of the process, it shows that Process 1 (the main tool) is waiting for process 2(the temporary tool in the par-<username> folder.
a screen shot of the detail task manager is attached.
Have anybody face such an issue with exiftool? Any suggestion or help is highly appreciated.
Thanks,
Abedellatif

Phil Harvey

This is what I think would happen if ExifTool is waiting for more input.  Did you use the -stay_open option by chance?

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

Abedellatif

Thanks a lot for your reply. Unfortunately, I tried the -stay_open option and still have the same behavior, still hangs forever.
Abedellatif

Phil Harvey

There is another possibility.  See this thread for details.

If this isn't the problem, then try executing other command-line utilities using the same technique to see if this works.

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

Abedellatif

Hello Phil,
I tried your suggestion and still having the same issue. One thing to note is this happens when Exiftool is invoked from particular application that I am working on. I tried invoking Exiftool from a test app and it works fine. I will keep checking on why it is hanging when it is called from this particular app.

Thanks alot.

Abedellatif

FixEUser

@JMac: Do you know this thread https://exiftool.org/forum/index.php/topic,5857.0.html ?