Newbie Question - Using Exiftool in VB.Net

Started by QPRJohn, May 21, 2014, 03:23:55 PM

Previous topic - Next topic

QPRJohn

Firstly Exiftool what a powerful application!  :)

I have produced an application in VB.NET that captions, performs basic edits and saves images to specified folders and FTP's them to a server. I have been able to adapt photoshop scripts to carry out the basic edit and save functions. I have produced a basic FTP upload app that runs within the app.

I have managed to import "descriptions" into my app, from either JPEG images or XMP files using VB.NET. Similarly I can show the "description" in a textbox, edit it and send it back to the corresponding image/s.

The problems all started when I wanted to be able to show all the XMP, IPTC etc; metadata from JPG's, save them as XMP's and display all the information in textboxes. Having a few problems along the way I wrote on several forums to which someone suggested using exiftool within my app.

I have done this and wow what a programme! I've managed to write code to get the tags one by one, I was going to put the resulting information in corresponding textboxes. The problem I have come up against is the time it takes my function to loop through the various tags is a very slow process. My function uses the ShellExecute method for each tag, so its opening and closing exiftool each time - not very efficient!!

Could anyone give me a steer in the right direction to find the most efficient way to do this please.

I have seen an example of some VB.NET code posted in this forum https://exiftool.org/forum/index.php?topic=1401.msg6120#msg6120 I have tried unsuccessfully to adapt this code to see if I can get it to work.

Thanks

John


Phil Harvey

Hi John,

First, you should be able to extract all the information you want with a single command, then parse the returned text to obtain what you need for your text boxes.  If VB.NET has a JSON parser, this would be a good way to do it (with the ExifTool -j option).

And to avoid the delay when running exiftool on the next file, you could use the -stay_open feature, but programming this gets trickier because it requires that you know how to handle pipes in VB.NET.

If anyone out there has some VB.NET experience, maybe they can help with some details.

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

QPRJohn

Thanks Phil

I have done some research on using VB.NET and JSON parser without any good leads on how to use it.

I've created a new thread titled VB.NET and JSON parser to hopefully attract the attention of someone who knows more about this.

I've also asked about preserving line feeds in strings.

I have some code that will extract all the exif data from a file using ExifTool.StartInfo.Arguments = "-L -all" + " " + Chr(34) + FileName + Chr(34)

This in turn is put into an array, where the tag name is shown on each line with its text, using a function I can separate the tagname and text, to put the text into appropriate textboxes.

Using the -b option will preserve the linefeeds, but will not show the tagname, therefore making my function fail.

Do you have any ideas?


Phil Harvey

To preserve newlines in the output you need some sort of format that allows the output to be parsed properly.  With the exiftool application, the -j, -php and -X options all do this.

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