Author Topic: exiftool .Net wrapper (written in vb.net)  (Read 32398 times)

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3964
Re: exiftool .Net wrapper (written in vb.net)
« Reply #15 on: July 02, 2018, 09:37:10 PM »
Yeah, the link appears dead and it doesn't look like it's been copied to another source and no sign of it in the Wayback Machine.  The post just above yours appears to have been the last post by Curtis.

You might try google for something similar.  I saw at least one other .net exiftool wrapper out there (NExifTool) though no idea how well it works.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Curtis

  • Sr. Member
  • ****
  • Posts: 115
Re: exiftool .Net wrapper (written in vb.net)
« Reply #16 on: July 02, 2018, 11:25:55 PM »
Tom,
Yes, that link is likely no longer good.
Best to just DL the source code  from original post. 
As far as the getting the shutter count I'm not familiar with the tag that would give you the shutter count. But if you know the tag name, then yes you should be able to get the value.
I have not actively worked on that code for quite a while, but if you have some specific questions, I'll do my best to answer.
Curtis

photos

  • Newbie
  • *
  • Posts: 2
Re: exiftool .Net wrapper (written in vb.net)
« Reply #17 on: July 03, 2018, 06:13:07 PM »
Hi Curtis,

Thanks for the response.  I managed to edit the project files to open the code in VS2010.  Looking at your code and a few trial and error tests found the shutter count in the maker notes, which for the Nikon cameras is under the Nikon TAG.  So;

Code: [Select]
                ExifToolIO.Initiailize()
                ExifToolIO.Cmd("-Nikon:ShutterCount")
                Dim tmpstr As String = ExifToolIO.Execute(ImageName)
                lblShutter.Text = tmpstr
                ExifToolIO.Close()

worked perfect for me.  Thanks for all of your efforts on your wrapper it looks to be very detailed.  It took five days of searching and many tests to get to a point which I though should only take a couple of hours :)
I had no idea how deep the water was.  Thanks again Curtis.

Curtis

  • Sr. Member
  • ****
  • Posts: 115
Re: exiftool .Net wrapper (written in vb.net)
« Reply #18 on: July 04, 2018, 11:32:38 PM »
Tom,
Glad you got it to work under VS 2010. I think you can download VS 2015 and 2017 for free... they have some nice new features.
Curtis

gkinney

  • Newbie
  • *
  • Posts: 4
Re: exiftool .Net wrapper (written in vb.net)
« Reply #19 on: September 17, 2019, 05:06:32 PM »
Hello Cutis, I know this is an old thread. I cannot get Windows 10 to allow the writing. I can do it in dos no problem. Any clue? If you even can remember your tool?

Thanks!

Curtis

  • Sr. Member
  • ****
  • Posts: 115
Re: exiftool .Net wrapper (written in vb.net)
« Reply #20 on: September 17, 2019, 09:00:14 PM »
Hi gkinney,
I don"t have a Windows 10 machine, only Windows 7, so I can't try to replicate your problem.  I don't understand if you have used my tool and it worked and if so on what kind of system? or ??  .Net I don't think runs under DOS?!.

If you can tell me more what you have tried I may be able to help...
Curtis

gkinney

  • Newbie
  • *
  • Posts: 4
Re: exiftool .Net wrapper (written in vb.net)
« Reply #21 on: September 18, 2019, 01:23:38 PM »
Hello Curtis, My apologies. I am using Visual Studio Community 2017. Version 15.9.15 on Windows 10 PRO

What I am seeing is that my app reads the tags I need (IPTC:Keywords) fine.
Then at some point, it stops allowing me to update the keywords in the file.  (Ive done it several times with ExifTooolIO from my project) and ExifTool.exe

However, I may be on to something!

I just caused an error when I selected a folder with no files and got an exception error selecting an item in a list control that was null. (my mistake) Hower now im seeing the rename error below. So this may be related to a locked file, or some other windows issue? Im looking at that now.

Attached is what I get when I know I am in fail mode:

Ill report back when I find a solution.

Thank you for your reply!



StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3964
Re: exiftool .Net wrapper (written in vb.net)
« Reply #22 on: September 18, 2019, 01:53:21 PM »
Error renaming temp files are usually caused by something having a lock on the original file.  The way exiftool works is that it creates a temporary file with the updates to the metadata, deletes the original, and renames the temp file.  If some program has the original file open for reading/writing, then the file can't be deleted and the temp file can't be renamed.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Curtis

  • Sr. Member
  • ****
  • Posts: 115
Re: exiftool .Net wrapper (written in vb.net)
« Reply #23 on: September 18, 2019, 02:04:26 PM »
What StarGeek said is correct.  That error message originates from ExifTool, not a problem with exiftoolio.

I noticed the file name you get the error on is:  C:/Gray/testfile.jpg
should the '/' be '\' ??  Not sure if that is a problem.

Opps... I just remembered I think ExifTool changes the \ to /  internally .. so all should be OK with that it just shows the / in the error message from ExiftTool....

PS: I use Unlocker to unlock locked files... really has helped me a lot in many situations.  Worth a try... it is here:
https://www.softpedia.com/get/System/System-Miscellaneous/Unlocker.shtml

gkinney

  • Newbie
  • *
  • Posts: 4
Re: exiftool .Net wrapper (written in vb.net) (SOLVED)
« Reply #24 on: September 19, 2019, 03:16:20 PM »
Curtis and Stargeek Thanks for your reply!

I was on the same path as the locked file, I just couldn't figure out why?

I FINALLY figured it out. I wrote this app and had a picture control in it to view the image. I loaded the image in the control and then read the keywords. I then did a save on the keywords and then would get the lock error. I suddenly realized, that MAYBE the file loaded by the pic control may be locking the file. BINGO! When I removed the file from being loaded in the pic control, the problem went away!

Thanks to everyone that jumped in here and sorry for the hassle. But may help the next person?

Have a great day!

saul

  • Newbie
  • *
  • Posts: 3
exiftool .Net wrapper efficiencies and which is the best / fastest wrapper?
« Reply #25 on: November 18, 2019, 05:47:50 PM »
Hi
Background: I have a C# / .Net application called Timelapse (http://saul.cpsc.ucalgary.ca/timelapse/) which biologists use to inspect and encode data describing thousands / millions of wildlife images captured by camera traps. Timelapse also allows the biologist to specify particular metadata fields that should be added to their data.

The issue is how to quickly extract the metadata field value in bulk over tens or even hundreds of thousands of images at a time.
 
I have used ExifToolWrapper in the past, but the current version of my system uses Drew Noak's Metadata extractor as it is an integrated dll (https://github.com/drewnoakes/metadata-extractor).

However, I was going to switch back to ExifTool (as it is much better at reading in makernotes from various cameras) but decided to run a speed test first.  (I can post / email the source for the test program if desired).

The time to extract the same metadata field over 1000 images is:
- ExifTool (using the ExifToolWrapper https://github.com/brain2cpu/ExiftoolWrapper): ~6.7 seconds
- MetadataExtractor: ~0.23 seconds
This is obviously a significant difference, and it can have huge impact on my users processing massive photo numbers.

Three questions
1. Are there other wrappers other than ExifToolWrapper that are faster and/or better that you can recommend?
3. Is the inefficiency in ExifTool, or in how ExifToolWrapper invokes it?
2. If you are familiar with ExifToolWrapper, is there a better way to get it to extract metadata fields aside from iterating over each file using MetadataExtractorGetFieldValue  - note that I am using exifTool.Start() before the loop, so I am just using one process vs. restarting ExifTool for every iteration.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3964
Re: exiftool .Net wrapper (written in vb.net)
« Reply #26 on: November 18, 2019, 06:21:37 PM »
I'm not sure how much help can be found here though there may be a few users who might chime in.  There haven't been too many questions along these lines over the years. 

What I can say is that exiftool is still a Perl application.  The Windows "executable" is, at it's heart, the Perl code packed with a minimal Perl interpreter.  There are going to be limitations compared to a purely compiled metadata extractor.

Any more details may have to wait until sometime next week, as Phil is currently away.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Curtis

  • Sr. Member
  • ****
  • Posts: 115
Re: exiftool .Net wrapper (written in vb.net)
« Reply #27 on: November 19, 2019, 01:33:09 PM »
Saul,
Have you tried the .net wrapper I wrote? (see first post on this thread) I have not used it lately, but as I recall it is much faster than taking 6.7 sec for 1,000 images.  Would be a very short C# or vb.net program to try that out with my wrapper. 

Also, I have a version that is multi threaded and will use up to all of the cores that you have to process the images.  I have not made this version available here as it is more complicated and few people had the need for that.

I'm traveling now so I don't have access to that code, but if you try my existing code and if it seems like it could work for you then I could possibly get the multi threaded version code to you later.

HTH,
Curtis

saul

  • Newbie
  • *
  • Posts: 3
Re: exiftool .Net wrapper (written in vb.net)
« Reply #28 on: November 20, 2019, 05:51:43 PM »
Thanks Curtis - I'll give this a shot and will get back to you. That multi-threaded version sounds very promising too, especially because its not unusual to have people trying to extract metadata from tens of thousands of images at a time.

saul

  • Newbie
  • *
  • Posts: 3
Re: exiftool .Net wrapper (written in vb.net)
« Reply #29 on: November 23, 2019, 11:16:38 AM »
Hello Curtis
dI just ran your program to test it against MetadataExtractor  and ExiftoolWrapper. Unfortunately, its slower: about 16 seconds vs ExifToolWrapper to extract a field from 1000 images (vs .~.2 secs for metadataExtractor).

For coding, I invoked (according to the documentation in your post):
-ExifToolIO.Initiailize();
-Iterated over (sorta pseudocode)
     for each path in paths
            ExifToolIO.Cmd(-IFD0:Make);
            return ExifToolIO.Execute(path);
-ExifToolIO.Close()

Another reply to my post suggests its an inherent performance limitation due to ExifTool being a Python program. I should test the raw ExifTool program to see how it performs as that would be the 'best result' I could get with it, where I could then compare it with the wrapper overhead.

FYI, My current workaround is to provide both MetadataExtractor and ExifToolWrapper to the user as a choice. If the desired metadata field is displayed using MetadataExtractor, then that is the way to go as it is fast. If not, they can use ExifToolWrapper to see if the desired metadata field is there, and if so use that along with a performance penalty. Not the best solution, but it seems to work.