You are not logged in.
Pages: 1
Hi everyone,
I am using ReNamer to rename the photo file, and I need to use the information of the Software tag in Exif, but ReNamer does not have this Meta Tag built in, so I use Pascal Script and use exiv2.exe and exifvalue.exe cooperates with ExecConsoleApp() to obtain this information, but this processing speed is slow, I often need to process dozens to hundreds of files at the same time.
Therefore, I want to try to use exiv2.dll with external commands, but I am not familiar with the Pascal language. The examples found on the Internet are also written in C++ language. I don’t have enough relevant experience to convert it to Pascal Script.
Is there anyone with relevant experience, please generously provide examples of using exiv2.dll for my reference, such as how to declare ExifData structure variables, how to refer to functions that read Exif tags, and how to read Software tag's content ... etc., thanks.
Last edited by Herman (2020-05-19 01:04)
Offline
Hi and welcome to the community!
As far as I know, calling a DLL is not implemented into ReNamers' PascalScript library.
https://www.den4b.com/wiki/ReNamer:Pasc … :Functions
Update (thanks to Herman): ReNamer: Pascal Script: Import functions (import DLL/call dll functions)
https://www.den4b.com/wiki/ReNamer:Pasc … _functions
Please wait what den4b can say about this.
Perhaps you can try to run a command line command from a PascalScript via ExecConsoleApp
https://www.den4b.com/wiki/ReNamer:Pasc … _Execution
to call RUNDLL32.exe which in turn calls the DLL in question?
https://en.wikibooks.org/wiki/Windows_B … g#RUNDLL32
But then you have to know which function inside of such DLL to call.
You can try that first in an cmd.exe command line window.
We use the EXE version of various command line tools to gather the wanted information.
They need mostly no installation, did not add extra costs and are small in file size.
You can test them in an cmd.exe window first and next execute that command with ReNamer too.
Basically it's works like this:
--- Download an tool:
exiv2.exe - https://www.exiv2.org/download.html
exiftool.exe - https://sno.phy.queensu.ca/~phil/exiftool/
Xpdf-pdfinfo.exe - http://www.xpdfreader.com/
MediaInfo - http://www.den4b.com/wiki/ReNamer:Scripts:MediaInfo
Be sure to read the license agreement and the documentation for the tool of your choice.
There may be other applications too, but this listed above are already know here.
--- Test it out:
Open a command prompt window. (((Win+R > cmd.exe > press Enter)))
Read the documentation how that tool works.
Read there forum how you can get the wanted result.
View the output of that tool in the command prompt.
You can also save that output to a text file:
yourTool.exe command parameters >>TESToutput.txt
--- Put the .exe file of such tool
in the same folder with the "ReNamer.exe".
--- Utilize an PascalScript
to automatically execute that commandline
command for each file and get the result
Pascal Script documentation:
https://www.den4b.com/wiki/ReNamer:Rules:PascalScript
Function reference:
https://www.den4b.com/wiki/ReNamer:Pasc … :Functions
Example scripts:
https://www.den4b.com/wiki/ReNamer:Scripts
--- Very basic not working example dummy script
EXECUTABLE = 'exiv2.exe'; //The tool exe in ReNamer folder
TAG = 'Exif.Image.Model'; //The wanted result from such an tool
PARAMETERS = '-Pt -K ' + TAG; //Parameters for that tool
begin
//Execute that tool for current file and store result in "Output"-variable
ExecConsoleApp('"'+EXECUTABLE+'" '+PARAMETERS+' "'+FilePath+'"', Output)
Here further process the "Output"-variable with PascalScript functions to get the really wanted format:
Output := Trim(Output);
Maybe use RegEx to extract parts of an resulting line:
myRegEx = 'Title\s*\:\s*(.*?)[\r\n]';
Matches := SubMatchesRegEx(Output, myRegEx, False);
Output := ReplaceRegEx(Output, '^(\d+(\.\d+)?)$', '$1', False, True);
Compose new filename:
FileName := Output + ' ' + FileName;
--or--
FileName := Output + WideExtractFileExt(FileName);
--or--
FileName := WideExtractBaseName(FileName) +'-'+ Output + WideExtractFileExt(FileName);
--- Get more help
You may want to search the ReNamer sub-forum for exiv2.exe or ExifTool.exe to find already the wanted examples.
Also den4b have provided scripts at that page >> https://www.den4b.com/wiki/ReNamer:Scripts
Please see if you can make use out of that information, for more question don't hesitate to ask again.
If you didn't get the wanted output from that example scripts,
post the commandline output of the tool and show us what exactly you want.
--- Example Outputs - show us which line hold the wanted result
Test output with exiftool.exe
https://sno.phy.queensu.ca/~phil/exiftool/
(((output here in German date format)))
D:\rive\Temp>exiftool.exe "TEST.pdf"
ExifTool Version Number : 9.69
File Name : TEST.pdf
Directory : .
File Size : 175 kB
File Modification Date/Time : 2011:02:09 12:49:14+01:00
File Access Date/Time : 2019:10:06 20:41:30+02:00
File Creation Date/Time : 2019:10:06 20:41:30+02:00
File Permissions : rw-rw-rw-
File Type : PDF
MIME Type : application/pdf
PDF Version : 1.4
Linearized : No
Page Count : 14
Modify Date : 2011:02:09 12:49:02+01:00
Create Date : 2011:02:09 12:49:02+01:00
Title : ExifTool by Phil Harvey
Author : name removed
Creator : Drucken
D:\rive\Temp>
Example Output
https://exiftool.org/exiftool_pod.html
> exiftool -h -canon t/images/Canon.jpg
File Name Canon.jpg
Camera Model Name Canon EOS DIGITAL REBEL
Date/Time Original 2003:12:04 06:46:52
Shooting Mode Bulb
Shutter Speed 4
Aperture 14.0
Metering Mode Center-weighted average
Exposure Compensation 0
ISO 100
Lens 18.0 - 55.0 mm
Focal Length 34.0 mm
Image Size 8x8
Quality RAW
Flash No Flash
White Balance Auto
Focus Mode Manual Focus (3)
Contrast +1
Sharpness +1
Saturation +1
Color Tone Normal
Color Space sRGB
File Size 2.6 kB
File Number 118-1861
Drive Mode Continuous Shooting
Owner Name Phil Harvey
Serial Number 0560018150
Command line utility examples
https://www.exiv2.org/sample.html
By default, the utility prints a summary of the Exif information
$ exiv2 img_1771.jpg
File name : img_1771.jpg
File size : 32764 Bytes
MIME type : image/jpeg
Image size : 480 x 360
Camera make : Canon
Camera model : Canon PowerShot S40
Image timestamp : 2003:12:14 12:01:44
Image number : 117-1771
Exposure time : 1/500 s
Aperture : F4.9
Exposure bias : 0 EV
Flash : No, auto
Flash bias : 0 EV
Focal length : 21.3 mm
Subject distance: 7.82 m
ISO speed : 100
Exposure mode : Program (P)
Metering mode : Center weighted average
Macro mode : Off
Image quality : Superfine
Exif Resolution : 2272 x 1704
White balance : Auto
Thumbnail : image/jpeg, 5448 Bytes
Copyright :
Exif comment :
You may want to search the ReNamer sub-forum for exiv2.exe or ExifTool.exe to find already posted examples.
Support for EXIF-data in CR2-files (Canon DSLR's RAW)
http://www.den4b.com/forum/viewtopic.ph … 515#p10515
Date and Time from RAW images (CRW, CR2, RAW)
https://www.den4b.com/forum/viewtopic.php?id=109
Here is the full output of "exiv2.exe -pa" command:
https://www.den4b.com/forum/viewtopic.p … 9565#p9565
Rename Files according to Endoded date
https://www.den4b.com/forum/viewtopic.php?id=2259
PDF tags (pdfinfo.exe)
https://www.den4b.com/forum/viewtopic.php?id=349
IPTC/XMP tag support
https://www.den4b.com/forum/viewtopic.php?id=407
Insert durations to the video files names (ExifTool)
https://www.den4b.com/forum/viewtopic.p … 8412#p8412
Custom EXIF Date
https://www.den4b.com/forum/viewtopic.p … 3736#p3736
ReNamer - RAW Version?
https://www.den4b.com/forum/viewtopic.php?id=2428
You may want to search the ReNamer sub-forum for exiv2.exe or ExifTool.exe to find more about that.
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
Hi Stefan,
Thank you for your reply, I am sorry that I did not express my needs very clearly.
I have tried to use command line commands from Pascal Script via ExecConsoleApp(), and I did get the Exif tag's data I need. However, when dealing with numerous files, frequent disk I/O actions also make the rename action slower.
Because I see that ReNamer provides the function of referencing external libraries, and Exiv2 also provides the DLL file, API documents and examples, so I would like to try to improve rename speed through this method for my script.
However, those files and examples are all based on C++, and I don't know how to convert and declare data structures, variable types and functions to Pascal Script. I need a practical related example to take me into this door.
Here are some related references information:
ReNamer: Pascal Script: Import functions
Exiv2 :: Image Class Reference
Offline
Thanks for the clarification.
Let's see what den4b says,
as far as I see
- The exiv2.dll contains the functions which are called by the exiv2.exe.
- There is no documentation how to call functions from the DLL without the EXE.
That means we can't call functions from the DLL directly via command line, so we can't use it here.
- The C++ code example is for to include the exiv2 source into an own application.
- If you would could call the DLL functions by an PascalScript there would still be I/O actions for each file.
So, for such many files you deal with,... why do you not utilize the exiv2.exe just directly from the command line?
Maybe you can also suppress the output text on the console to speed up the process.
In an next step load the renamed files into ReNamer to do the more detailed work if needed.
Are you able to tell us how many files you want to rename, on which device the are located, and your complete wanted renaming steps?
Just some ideas, I don't want to stop you from your experiment with the dll ;-)
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
Hi Stefan,
I take pictures to record the life of my family and the growth of flowers and plants, so I took a lot of pictures and very often.
ReNamer is an excellent tool, it can meet all my renaming requirements and the renaming speed is very fast. When I said, "slower", it actually means "Relative speed," calling external programs to obtain tag data is much slower than using built-in functions. This is not ReNamer's problem, but I asked too much.
I think I have a wrong idea, thank you for your reply again and clear my mind.
Offline
Pages: 1