exiv2 icon indicating copy to clipboard operation
exiv2 copied to clipboard

Feature Request: exiv2 rename to allow all exiv2 tags

Open Saijin-Naib opened this issue 2 years ago • 3 comments

Is your feature request related to a problem?

For many years on Windows I've been using ReNamer from den4b with exiv2 and some custom perl-scripting to make uniquely named photos an easy thing on my photo library. I use exiv2's rename functionality alongside inserting the Exif.Image.Model tag. The resultant filenames are like such:

2022-05-16 20.43.31 [Camera].extension
Describe the solution you would like

I would like the exiv2 rename function to accept any exiv2 tag. I'm not sure what the best syntax would be, or how it'd have to be "wrapped" to not be interpreted as a literal, but maybe something like this:

exiv2 rename -r ":Exif.Photo.DateTimeOriginal: [:Exif.Image.Model:]"
Describe alternatives you have considered

Due to lack of multilib support on my distro, I can not run ReNamer via WINE. I am not good with shell-scripting and I do not trust myself to write code that will safely mv/rename my images.

Additional context

FR was briefly discussed/asked intially on the exiv2 Matrix channel.

Saijin-Naib avatar May 17 '22 00:05 Saijin-Naib

@Saijin-Naib: As you have found, currently the model name is unavailable for use when renaming with the Exiv2 application. The usual workaround is to write a script using exiv2 but this isn't an option here.

Instead, you could use the ExifTool command line program. The ExifTool manpage explains how to use the software, with the renaming examples being particularly useful for you. A complete list of all the tags supported by ExifTool is available here.

We can leave this FR open and hopefully at some point, the feature can be added to the Exiv2 application.

postscript-dev avatar May 28 '22 14:05 postscript-dev

I started to work on this issue. Here some details:

  • The syntax: the tag name has to be enclosed in colons. This is similar to using the existing placeholders like :basename:, so I think this will be very convenient.
  • The placeholder will be replaced by translated value, not by the plain value, as I think intention is to have a easy readable file name.
  • If the tag is not included in the image or the translated value is empty, a warning is printed.
  • Characters in tag's translated value, which are not allowed in file names, will be replaced by underscore. The characters to replace are: \\/:*?\"<>|. This list is valid for Windows. If on other supported operating systems (which I am not familiar with) additional characters need to be replaced, please let me know.

@Saijin-Naib Does this fit to your needs?

norbertwg avatar Oct 03 '23 14:10 norbertwg

Yes, that's absolutely perfect! Thank you!

I think for Linux only the / is reserved, so your list looks great to me.

Saijin-Naib avatar Oct 03 '23 15:10 Saijin-Naib