Main Menu

.NET "wrapper" dll

Started by brain2cpu, September 13, 2013, 08:27:20 AM

Previous topic - Next topic


Quote from: brain2cpu on May 27, 2015, 05:51:22 AM
SarahC, I just downloaded your source code and noticed you converted the C# code to vb, did you tried using the dll instead? I'm using it in my mp3Manager without problems.

Sorry, I've been away from my dev environment!

I'll try that, for sure! That may have cured it - but the error only occurs on huge lists - is your MP3 collection large?

(and how do I get notifications on here?! I'm off to check "properties".)


I'm getting the following error when the Start() method is executed:

The specified executable is not a valid application for this OS platform.

                ExifToolWrapper etw = new ExifToolWrapper();


I'm running VS 2015 on Windows 10


Did you replaced the dummy exiftool exe with the real one?



Sorry to resurrect an old thread.  I've been playing around with the tool and it works great :)  However, I was wondering if there's any way to pass in a stream to a file instead of the physical file itself?  Often case, the only thing I get is a byte array of the file.  So instead of saving all the bytes to a temporary file, I would like to just pass in that byte array as a stream.


Phil Harvey

This is a basic functionality for the Image::ExifTool Perl library, but unfortunately the .NET wrapper goes through the exiftool application.  Here, the only thing you could possibly do would be to create some sort of pipe from your bytes array (which may be possible with .NET, I don't know), but then you would probably run into troubles with the .NET wrapper not supporting pipes (I'm guessing the wrapper probably uses pipes for the command-line arguments, and if so you probably can't pipe the images too).

So without knowing how the .NET wrapper works, I am guessing that it won't do what you want.

You could, however, launch ExifTool directly piping the image if you can figure out how to do that, without the ExifTool .NET wrapper.

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


Unfortunately the wrapper does not support byte array, it works with filenames only.


Fantastic Tool and Wrapper!

I'm using the wrapper and the code executes until I call SetExifInto(). At that point my C# code pauses and will not continue. Am I doing something wrong? Do I need to call the function in a different manner or is it something else?

Some notes:
1) I can see that d is being populated and changed properly.
2) The SetExifInto is working and changing the 'Make' in the image's properties
3) When I call Start() two different exittool(-k).exes start up. And remain open the whole time. The first one has a memory footprint of 44MBs and the 2nd has a memory footprint of 0.6MBs

        public static void writeTag5()
            using (BBCSharp.ExifToolWrapper extw = new ExifToolWrapper())
                // Start ExifTool
                // Get Metadata
                Dictionary<string, string> d = extw.FetchExifFrom("C:\\Users\\donal\\Desktop\\P1020661_Fixed_b_w2.jpg");
                // Remove existing Lens Model
                // Add new Lens Model
                d.Add("Make", "testing");
                //Write new Metadata
                extw.SetExifInto("C:\\Users\\donal\\Desktop\\P1020661_Fixed_b_w2.jpg", d, true);




Everything seems alright in your code and notes, but it is not the best way to do it. You should send to SetExifInto() only things you want to change:

extw.SetExifInto("C:\\Users\\donal\\Desktop\\P1020661_Fixed_b_w2.jpg", new Dictionary<string, string> { ["Make"] = "testing" }, true);

however the code should not stop.


Please use this new version, a possible stall in SetExifInto is fixed.


ExiftoolWrapper is hosted on GitHub
a NuGet package is available too:

The latest version can handle non-ascii filenames (discussed in

Phil Harvey

Great, thanks for the update!

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


I'm using the latest ExiftoolWrapper from GitHub with the latest Exiftool; reading data with FetchExifFrom seems to work great but when I try to write it back to a new file via SetExifInto things are a bit odd. What I'm finding is that many of the fields appear to be missing (e.g. "Author" will be filled in but "Date Taken" will be gone, "Camera maker" will be there but "Camera model" will be gone. I'm not doing anything to modify the Dictionary that's originally retrieved; we're creating a fresh new JPG based on the original so the new file has no metadata at all and we want to copy it across. One we have that working, THEN we'll want to support editing some of the metadata fields and include those changes when we save the file.

For now I'd just like to figure out why these gaps appear and I'm not quite sure how to proceed.


I'm having trouble reading multi-line Descriptions with ExifTool via the ExifToolWrapper and I'm not sure it's an issue with ExifTool or the wrapper itself. What I'm seeing is that if you go into something like Adobe Bridge and add a multi-line Description to an image (just press ENTER between each line) then you'll find that description is correctly saved and displays as multi-line when you re-load the image into Bridge or other metadata viewers. When I try and read it, what seems to happen is that somewhere along the way the "Newlines" (CR/LF or however its stored ... maybe an ASCII 13) are being converted to a period (.) and so I just get back a string with the lines concatenated with a period in between.

I'd love to know if this is a limitation of ExifTool or if it's coming from the wrapper; just helps give me a direction to investigate and resolve the issue.

Thanks much!

Phil Harvey

The default output of the exiftool app converts newlines to a period.  To get the newlines, the -b, -j, -X, -php or -csv option may be used.  The C++ interface for ExifTool uses the -php option when extracting information.

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