Author Topic: .NET "wrapper" dll  (Read 34054 times)

SarahC

  • Newbie
  • *
  • Posts: 5
Re: .NET "wrapper" dll
« Reply #15 on: June 02, 2015, 03:45:15 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".)

rkamarowski

  • Newbie
  • *
  • Posts: 2
Re: .NET "wrapper" dll
« Reply #16 on: January 23, 2016, 01:49:31 PM »
I'm getting the following error when the Start() method is executed:

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

Code: [Select]
                ExifToolWrapper etw = new ExifToolWrapper();

                etw.Start();

I'm running VS 2015 on Windows 10

brain2cpu

  • Newbie
  • *
  • Posts: 9
Re: .NET "wrapper" dll
« Reply #17 on: January 23, 2016, 03:16:57 PM »
Did you replaced the dummy exiftool exe with the real one?

rkamarowski

  • Newbie
  • *
  • Posts: 2
Re: .NET "wrapper" dll
« Reply #18 on: January 23, 2016, 04:47:51 PM »
ugh... thank you!

lyrico

  • Newbie
  • *
  • Posts: 1
Re: .NET "wrapper" dll
« Reply #19 on: November 16, 2016, 03:11:59 PM »
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.

Thanks!

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14748
    • ExifTool Home Page
Re: .NET "wrapper" dll
« Reply #20 on: November 16, 2016, 03:41:54 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

brain2cpu

  • Newbie
  • *
  • Posts: 9
Re: .NET "wrapper" dll
« Reply #21 on: November 17, 2016, 04:22:03 AM »
Unfortunately the wrapper does not support byte array, it works with filenames only.

macdonnie

  • Newbie
  • *
  • Posts: 1
Re: .NET "wrapper" dll
« Reply #22 on: December 05, 2016, 08:59:44 PM »
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


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

            }
        }

Thanks,
-Don

brain2cpu

  • Newbie
  • *
  • Posts: 9
Re: .NET "wrapper" dll
« Reply #23 on: December 06, 2016, 03:40:48 AM »
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:
Code: [Select]
extw.SetExifInto("C:\\Users\\donal\\Desktop\\P1020661_Fixed_b_w2.jpg", new Dictionary<string, string> { ["Make"] = "testing" }, true);
however the code should not stop.

brain2cpu

  • Newbie
  • *
  • Posts: 9
Re: .NET "wrapper" dll
« Reply #24 on: January 10, 2017, 05:48:07 AM »
Please use this new version, a possible stall in SetExifInto is fixed.

brain2cpu

  • Newbie
  • *
  • Posts: 9
Re: .NET "wrapper" dll
« Reply #25 on: September 27, 2018, 04:28:46 AM »
ExiftoolWrapper is hosted on GitHub
https://github.com/brain2cpu/ExiftoolWrapper
a NuGet package is available too:
https://www.nuget.org/packages/ExiftoolWrapper/

The latest version can handle non-ascii filenames (discussed in http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=8382.0).

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14748
    • ExifTool Home Page
Re: .NET "wrapper" dll
« Reply #26 on: September 27, 2018, 08:03:31 AM »
Great, thanks for the update!

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

VeryKross

  • Newbie
  • *
  • Posts: 4
Re: .NET "wrapper" dll
« Reply #27 on: February 03, 2019, 11:54:02 PM »
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.

VeryKross

  • Newbie
  • *
  • Posts: 4
Re: .NET "wrapper" dll
« Reply #28 on: June 03, 2019, 08:54:40 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14748
    • ExifTool Home Page
Re: .NET "wrapper" dll
« Reply #29 on: June 03, 2019, 09:11:43 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).