#1 2018-08-22 09:00

Thomas Magnum
Member
Registered: 2018-08-22
Posts: 6

ReNamer - RAW Version?

Hello,

I want to use Rename to rename my *.jpg and my *.cr2 files. I use the portable version of the program.
For the *.jpg files everything works like a charme, but with my *.cr2 files I have trouble. I read the Wiki article, load and copy the exiv2 files into the program folder, but I always get the error that several *.dll files are not registered.

What can I do to get the renaming for *.cr2 files working?
Is there a new "cr2 ready" ZIP File available?

I appreciate any response.

Best regards, Thomas

Last edited by Thomas Magnum (2018-08-22 09:01)

Offline

#2 2018-08-22 19:41

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: ReNamer - RAW Version?

Hi and welcome Thomas.

There should be no problem renaming any file whatever extension.

What exactly is the "trouble" you encountered?
Do you need EXIF information for your renaming?
Without details from your side it's hard to guess what's going wrong.
WHICH "dll files are not registered" on your PC?


 
For others, when Thomas is talking about "cr2 ready" he mean that > http://www.den4b.com/forum/viewtopic.php?id=1789


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

#3 2018-08-23 07:27

Thomas Magnum
Member
Registered: 2018-08-22
Posts: 6

Re: ReNamer - RAW Version?

ok, let me explain my needs a little bit detailed.
Now without adding Exiv2 and the Installer Version of ReNamer.

My current filename: IMG_6844.cr2 or IMG_6844.jpg
What I want: [dd-mmm-yyyy]-[hh-mm-ss] - [EXIF_Model] - 001.jpg / [dd-mmm-yyyy]-[hh-mm-ss] - [EXIF_Model] - 001.cr2
Where the 001 is a serealize if I shoot more than one pictures in a second.

What I did:
First I added the rule (Pascal - Date and Time) and adapted this rule to my needs ([dd-mmm-yyyy]-[hh-mm-ss]). This is working.
As second rule I add (Insert -  - [:EXIF_Model:] - ). If I activate this rule the only at the *.jpg files the EXIF_Model will be added.
Third rule is the Serialize the files, this is working.

I hope this explains my wish a little bit better and may someone can help me.

Questions:
How can I fulfill my needs and add the "EXIF_Model" Name to any filename, jpg and cr2? Do I have to extend the "Pascal rule" and if yes, how.

I hope this explains my wish a little bit better and may someone can help me.

Thanks in advance!

Thomas

Offline

#4 2018-08-23 08:07

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: ReNamer - RAW Version?

Thanks.
And what now about "exiv2 files" and "error that several *.dll files are not registered" ?

Which ReNamer version do you use?
Which OS and which Bit-Architecture 32/64?
Which "exiv2" version did you downloaded and from where?
What are that "error" messages which I am thinking are Information messages? (Try Ctrl+C on that message and paste here)


Maybe you can exchange that cr2 file with us so we can check our self?
Did that cr2 file contain that "EXIF_Model" information at all?



 


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

#5 2018-08-23 09:59

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: ReNamer - RAW Version?

I have seen the "exiv2-0.26-mingw.tar.gz" wants you to register the DLLs (like libgcc_s_dw2-1.dll) first?
So maybe use  "exiv2-0.26-msvc.tar.gz" instead. I have summarized this there > http://www.den4b.com/forum/viewtopic.ph … 515#p10515


 


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

#6 2018-08-23 12:39

Thomas Magnum
Member
Registered: 2018-08-22
Posts: 6

Re: ReNamer - RAW Version?

Hi Stefan,

following your recomendations now no more errors occure. With the script mentioned in your link (h**p://www.den4b.com/forum/viewtopic.php?id=1789) now the date from the cr2 files could be read and write.

Thanks so far!

What still not works is the "EXIF_Model" rule. How can I adapt the script to add this informatin in my filemane?
Details see in my former post or the attachement (h**p://www.den4b.com/forum/img/members/4331/rename-cr2-jpg.jpg).

Last edited by Thomas Magnum (2018-08-23 12:40)

Offline

#7 2018-08-23 12:58

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: ReNamer - RAW Version?

>> How can I adapt the script to add this information


- execute that exiv2.exe at a command prompt (read the help of that tool)
- give one of your cr2 files as parameter
- inspect the output if there is such "EXIF_Model" line
- paste that output here as post



Next we had to create a RegEx pattern to extract that line from the output

Examples from the above script:
EXE = 'exiv2.exe';
TAG = 'Image timestamp\s*\:\s*(.*?)[\r\n]';

To extract IPTC Headline tag, you would need to make following changes:
EXE = 'exiv2.exe -pi';
TAG = 'Iptc.Application2.Headline\s*\w*\s*\d*\s*(.*?)[\r\n]';




If that is to much for you, exchange one of the cr2 files with us and we would take a look.

 


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

#8 2018-08-25 08:40

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: ReNamer - RAW Version?

Other way around, why not rename the CR2 after the JPG renaming whit those new jpg name, instead of renaming both at first with rules?




Example - Rename JPG first, after that rename CR2 like the corresponding jpg file.


STEP 1:
Rename all JPG (jpg only)
IMG_6844.jpg
IMG_6844.cr2


Add rule like you want to get:
[dd-mmm-yyyy]-[hh-mm-ss] - [EXIF_Model] - 001.jpg


Add the end add Rule:
Insert: Insert ":File_FileName:#" as Prefix (skip extension)


Result:
IMG_6844#[dd-mmm-yyyy]-[hh-mm-ss] - [EXIF_Model] - 001.jpg
IMG_6844.cr2




STEP 2:
Use PowerShell to rename all CR2 like the JPG (and also remove the old file name, used as marker)
dir *.JPG|ForEach{$A,$B=$_.BaseName -split('#');Ren $_.Name ("{0}.{1}" -f $B,$_.Extension); Ren "$A.cr2" "$B.cr2"}


TIP: The "#" is a sign not in original file name. Attention: "-Split" use RegEx.

Explanation:
$A will hold "IMG_6844"
$B will hold "[dd-mmm-yyyy]-[hh-mm-ss] - [EXIF_Model] - 001"


Result:
[dd-mmm-yyyy]-[hh-mm-ss] - [EXIF_Model] - 001.jpg
[dd-mmm-yyyy]-[hh-mm-ss] - [EXIF_Model] - 001.cr2




 


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

#9 2018-08-25 09:35

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,376

Re: ReNamer - RAW Version?

Thomas,

The built-in meta tags have a limited file format support. Currently, EXIF_Model works only with JPG and some TIFF file formats.

You can use another library in combination with ReNamer, such as Exiv2, as described here:
http://www.den4b.com/wiki/ReNamer:Scripts:Exiv2

Exiv2 comes in different build packages, which have different run-time dependencies. It is best if you use the Visual Studio package, as you will have higher chances of matching the required dependencies (think of the missing DLLs):
http://www.exiv2.org/builds/exiv2-0.26-msvc.tar.gz

Extract it to a temporary location and locate the "bin" folder which contains the "exiv2.exe" file. You may find multiple such folders, where each may have different run-time dependencies yet again. Just pick one and copy the contents of the  entire "bin" folder into the ReNamer's directory.

I have just tried it with "dist\2015\Win32\dll\Release\bin\" folder from "exiv2-0.26-msvc.tar.gz" and it worked fine.

If you are still having dependency issues (missing DLLs), then you'll need to download and install Visual Studio Redistributables from Microsoft's website.

Then, you can finally get down to renaming. Here is a sample script which will extract specifically the EXIF Model tag:

const
  TAG = 'Exif.Image.Model';
  EXECUTABLE = 'exiv2.exe';
  PARAMETERS = '-Pt -K ' + TAG;
var
  Command, Output: String;
  UnicodeOutput: WideString;
begin
  Command := '"' + EXECUTABLE + '" ' + PARAMETERS + ' "' + FilePath + '"';
  if ExecConsoleApp(Command, Output) = 0 then
  begin
    UnicodeOutput := WideTrim(OemToWide(Output));
    if Length(UnicodeOutput) > 0 then
      FileName := UnicodeOutput + ' ' + FileName;
  end;
end.      

P.S. Wiki article has been updated to include this script.

Last edited by den4b (2018-08-25 10:05)

Offline

#10 2018-08-27 12:43

Thomas Magnum
Member
Registered: 2018-08-22
Posts: 6

Re: ReNamer - RAW Version?

Hello,

thanks for all you hints, but unfortunatelly noone is working.

What I did:

Stefan
I read out the EXIF like Stefan described, here are the output:
File name       : test.cr2
File size       : 18334724 Bytes
MIME type       : image/x-canon-cr2
Image size      : 4416 x 3312
Camera make     : Canon
Camera model    : Canon PowerShot G10
Image timestamp : 2018:08:11 19:18:43
Image number    : 102-6843
Exposure time   : 1/125 s
Aperture        : F7.1
Exposure bias   : -1/3 EV
Flash           : No, compulsory
Flash bias      : 0 EV
Focal length    : 30.5 mm
Subject distance: 973
ISO speed       : 400
Exposure mode   : Aperture priority (Av)
Metering mode   : Center weighted average
Macro mode      : Off
Image quality   : RAW
Exif Resolution : 1600 x 1200
White balance   : Auto
Thumbnail       : image/jpeg, 5181 Bytes
Copyright       :
Exif comment    :

I read a lot about regex, but did not understand this completly, so I have no glue what to do next.

The second solution did also not work forme, and it seems a little bit to complicated. :/

den4b:
I tried it, but with your code nothing happens to the name. If I run the command "exiv2 -Pt -K Exif.Image.Model test.CR" the output was generated. Only if I use it in a "pascal script" it won't work.

May you have some more patience with me ;-)

Thomas

Offline

Board footer

Powered by FluxBB