Project

General

Profile

Can't locate ~/.exiv2 file

Added by Karsten Salewski over 4 years ago

Hi all!

I am just trying to add a lens to the exiv2 library. I found the following two articles.

http://dev.exiv2.org/projects/exiv2/wiki/Lens_Recognition_in_Exiv2_v026_(and_later)/
http://dev.exiv2.org/boards/3/topics/2843

It seems I have to modify ~/.exiv2 file. However, I can't locate that file on my harddisk.
Does anybody knows where to find that file or where to get it?

Many thanks in advance!

Karsten


Replies (9)

RE: Can't locate ~/.exiv2 file - Added by Robin Mills over 4 years ago

Karsten

Just write the file with a text editor. It's not present by default. You can determine the path with this command:

679 rmills@rmillsmbp:~/gnu/exiv2/team/releases $ exiv2 -vVg config_path
exiv2 0.26 001a00 (64 bit build)
config_path=/Users/rmills/.exiv2
680 rmills@rmillsmbp:~/gnu/exiv2/team/releases $

RE: Can't locate ~/.exiv2 file - Added by Karsten Salewski over 4 years ago

Hi Robin,

thank you very much for the quick response!
I have just tried to apply it to my system. But actually I don't understand it. I can't map your answer to the files and folder structure on my system.
I am using openSuSE Leap 42.2. There is no ~/gnu folder. I've just installed exiv2 0.26

I do find an exiv2 folder in /usr/share/doc/packages/
That directory also contains the exiftool directory.

The exiv2 directory (/usr/share/doc/packages/exiv2) contains the two files: ChangeLog and cmd.txt

Is that where the .exiv2 file needs to be stored?

Regards,

Karsten

RE: Can't locate ~/.exiv2 file - Added by Karsten Salewski over 4 years ago

I also did:

[code]
/usr/local/bin/exiv2 -vVg config_path
exiv2 0.26 001a00 (64 bit build)
config_path=/root/.exiv2
[/code]

RE: Can't locate ~/.exiv2 file - Added by Robin Mills over 4 years ago

Karsten

You are trying to hard. It's the file ~/.exiv2 (on windows it's slightly different), however the command $ exiv2 --verbose --version --grep config_path will tell you the exact path. On the Mac, my home directory ~ is the path /Users/rmills (for me).

Here are the contents of ~/.exiv2 on my computer:

$ cat ~/.exiv2
[canon]
# 110=Samyang 35mm F1.4 AS UMC
# 247=Samyang 14mm f/2.8 AE ED AS IF UMC
# 65535=The lens in issue 1251

[nikon]
# 146=Robin's Sigma Lens

[pentax]
# 3 255 0 0=another pentax lens

[minolta]
# 255=a sony lens

[olympus]
None=something
$
The file is in Windows .ini format. I have a section for different cameras. A # is a comment. So effectively, I have nothing in my file. However I often modify the file for test purposes.

RE: Can't locate ~/.exiv2 file - Added by Robin Mills over 4 years ago

Edit the file /root/.exiv2

Can you send me a test file using your lens and let me know which lens you are using.

RE: Can't locate ~/.exiv2 file - Added by Karsten Salewski over 4 years ago

Thank you very much for your support, Robin.
I understand now where to store the .exiv2 file.
But I don't find the according attributes in the files.

Maybe you can tell how this works.

  1. _IMG1478.jpg; Lens: Sigma, 3,5/180mm APO MACRO, Lens ID: "Sigma", Lens Type: "Sigma"
    Darktable shows "Sigma Lens" in Lens info panel
  2. _IMG1588.jpg; Lens: Pentax SMC-FA 2.8/20mm, Lens ID: "smc PENTAX-FA 20mm F2.8", Lens Type: "smc PENTAX-FA 20mm F2.8"
    Darktable shows "smc PENTAX-FA 20mm F2.8" in the info panel, which is correct!
  3. _IMG8987.jpg; Lens Pentax HD PENTAX-D FA 2,8/24-70mm, Lens ID: "HD PENTAX-D FA 24-70mm F2.8 ED SDM WR", Lens Type: "HD PENTAX-D FA 24-70mm F2.8 ED SDM WR"
    Darktable shows "Unknown (0x083e)" in Lens info panel.

I would like to change the 180mm and 24-70mm lens. However, will be sufficient if you can tell me how to setup the .exiv2 file for one example. I think I can do the other one myself then.

Best Regards,

Karsten

RE: Can't locate ~/.exiv2 file - Added by Robin Mills over 4 years ago

I'm very surprised that you are having any difficulty with this. The exiv2 config file (~/.exiv2) is a new feature of v0.26 and you're the first person who has discussed this on the forum. I hope this feature is not causing difficulty for other users.

Step 1 - Default behaviour

707 rmills@rmillsmbp:~ $ rm -rf ~/.exiv2
708 rmills@rmillsmbp:~ $ exiv2 -pa --grep lenstype/i  ~/Downloads/*.jpg
/Users/rmills/Downloads/_IMG1478.jpg  Exif.PentaxDng.LensType                      Byte        4  Sigma Lens
/Users/rmills/Downloads/_IMG1588.jpg  Exif.PentaxDng.LensType                      Byte        4  smc PENTAX-FA 20mm F2.8
/Users/rmills/Downloads/_IMG8987.jpg  Exif.PentaxDng.LensType                      Byte        4  HD PENTAX-D FA 24-70mm F2.8 ED SDM WR
709 rmills@rmillsmbp:~ $ 
Exiv2 recognises the lens in _IMG1588.jpg. However it's hardly knows what lens is used _IMG1478 and wrong about the lens in _IMG8987.jpg.

Step 2 - Find the lens identifiers

709 rmills@rmillsmbp:~ $ exiv2 -pv --grep lenstype/i  ~/Downloads/*.jpg
/Users/rmills/Downloads/_IMG1478.jpg  0x003f PentaxDng    LensType                    Byte        4  3 0 0 0
/Users/rmills/Downloads/_IMG1588.jpg  0x003f PentaxDng    LensType                    Byte        4  6 9 0 0
/Users/rmills/Downloads/_IMG8987.jpg  0x003f PentaxDng    LensType                    Byte        4  8 62 0 0
710 rmills@rmillsmbp:~ $ 

Step 3 - Update ~/.exiv2

710 rmills@rmillsmbp:~ $ cat ~/.exiv2
[pentax]
3 0 0 0=Sigma, 3,5/180mm APO MACRO
8 62 0 0=HD PENTAX-D FA 24-70mm F2.8 ED SDM WR

711 rmills@rmillsmbp:~ $ 

Step 4 - Run exiv2 again

711 rmills@rmillsmbp:~ $ exiv2 -pa --grep lenstype/i  ~/Downloads/*.jpg
/Users/rmills/Downloads/_IMG1478.jpg  Exif.PentaxDng.LensType                      Byte        4  Sigma, 3,5/180mm APO MACRO
/Users/rmills/Downloads/_IMG1588.jpg  Exif.PentaxDng.LensType                      Byte        4  smc PENTAX-FA 20mm F2.8
/Users/rmills/Downloads/_IMG8987.jpg  Exif.PentaxDng.LensType                      Byte        4  HD PENTAX-D FA 24-70mm F2.8 ED SDM WR
712 rmills@rmillsmbp:~ $ 

Commentary Why does this work?

Metadata in an image consists of tags and data. The tag identifies the purpose of the data, and data can be a string, or number, or an array of numbers (and some other types). A Pentax image does not contain a string with the name of the lens. It contains a tag Exif.PentaxDng.LensType whose data is an array of integers (usually 4 of them). The command $ exiv2 -pv --grep lenstype/i foo.jpg shows you the data in the tag Exif.PentaxDng.LensType. Exiv2 uses the data to determine the lens. However Exiv2 does not know about every lens ever made and cannot know about new lenses which appear on the market.

The Exiv2 config file ~/.exiv2 was added in v0.26 for two purposes:

1) To enable users to add a lens to exiv2 without having to wait for an update to the library.
2) To enable users to change a lens identification if Exiv2 does not have the correct value. You'll be surprised to discover that it's quite common for camera manufacturers to have the same lens identifier used by more than 20 different lenses.

I hope that makes sense and fixes everything for you. Darktable uses exiv2 and will correctly identify your lenses when you use a version of darktable which uses exiv2 v0.26.

RE: Can't locate ~/.exiv2 file - Added by Karsten Salewski over 4 years ago

Hi Robin,

thank you very much for the support. It does work now as you explained. I also added the Sigma 24-70mm F2.8 EX DG HSM to the list ;-)
However, now I have to talk to the darktable guys when exiv2 2.6.0 will be integrated into darktable.
And also my Linux distribution does not contain V 2.6.0 yet.

However, I understand what needs to be done to get it running. It just takes a little time until V 2.6.0 is fully integrated into darktable and opensuse.

Best Regards and a good remaining week end to you!

Karsten

RE: Can't locate ~/.exiv2 file - Added by Robin Mills over 4 years ago

If you're willing to build darktable from source code, you can have exiv2 v0.26 support today. I checked the darktable web-site and 2.2.5 was released in June. It might have Exiv2 v0.26 support. However, I think a little patience will work just as well and everything will come together in September or so. It never ceases to amaze me that open-source works. The exiv2 code travels from my computer to one billion linux machines (and millions of Windows and MacOSX machines) in less than a year! Amazing, humbling and a little scary.

    (1-9/9)