All » Articles » Linux (5)
All » Downloads (10)

Lensset - add vintage manual lens data to photos EXIF (shell script)

Posted by: Ferenc Veres on August 1, 2021 09:31:19 AM +00:00(2424 Reads)

This is a command line tool, tested on Linux only. Its use is quite hardcore, but maybe I'll improve that later on. Just wanted to publish finally, after using it for many years.

  • Shows or sets lens data in EXIF
  • Best used with old manual lenses that do not set the EXIF data.
  • Requires Exiv2 to manipulate EXIF!

 

Installation

  1. Tested on Linux only. Current version download: lensset-1.4
  2. Install exiv2
  3. Copy lensset_data files to your home dir ~/.lensset/ folder
  4. Create more of your own lens data files (see below) (please send them to me!)
  5. Optional: Add your lens SERIAL NUMBERS to lensset data files (see below)
  6. Change focal length multiplier if necessary (if not 1.5)! (see below)
  7. Copy lensset executable to your path (~/bin)
  8. See help with lensset -h

Photo of two old Jupiter lenses


Usage

You'll need take some notes of the lens while taking photographs. When you change lens:

a.) FUJIFILM MILC camreas allow setting custom focal length when a manual lens is installed, so the value of 50mm, 135mm, etc will be correctly saved to the JPG. The program can display this information so you can figure out which lens was in use. Use "lensset -sf" to show Focal Length.

Fuji camera settings displaying various lens focal lengths to choose from

b.) Take photo of the lens before you mount it. (But you will forget this, so I often write a note and take a photo of that note. E.g.  ALL FLOWERS 50MM PENTAX.)

c.) Make a little notebook, each page showing just one lens name like, PENTAX 50 FROM HERE, PENTAX 50 TILL HERE, MEYER 135 FROM HERE, MEYER 135 ... Then of course take a photo of one page from the note at changing lens or when you notice the forgotten change.

Little notebook showing "pentax 50 till here" (in Hungarian)

Usage:
  lensset OPTIONS [STARTFILE] - [ENDFILE]

-s: show lens model of all or range of JPEG files
    -f: show focal length instead of lens model
-u LENS: update lens data in a range of JPEG files
    example: lensset -u meyer135 DSCF100.JPG DSCF110.JPG
    see available lens files with -l command
    -o: overwrite lens info (otherwise exits if any file has info)
    -y: do not ask to confirm number of files, assume yes
-c NUM: lens crop factor to recalculate 35mm Focal Length
    from value of FocalLength (0 to disable, default)
-l: list available lens files from /home/lion/.lensset
    the lens files must be exiv2 -m command files see 'man exiv2'
-h: this help
-v: show version

Note the special file name handling! Since shell does not have a FROM-TO  glob extension (AFAIK), this is implemented in the program, so you must not use shell glob like *.JPG!!! (The possibility to implement that later is preserved by using "-" notation for ranges.)

If you specify one file only, that will be used. If you specify two names  all files between them will be updated. There will be a confirm message  showing number of files which will be updated. The order of files may be  different from what you see in "ls -l" command, because of different ASCII  ordering used in the program (via awk). To be sure, find your ranges from output of "lensset -s" command.

If you omit both from and to files, all files will be processed. Best used with lensset -s mainly.

Example run:

$ lensset -u pentax50 DSCF3207.JPG - DSCF3323.JPG
Are you sure to process this number of files (y/n): 57
y
Done.
$ lensset -s DSCF3207.JPG - DSCF3323.JPG
DSCF3207.JPG: SMC PENTAX-M 50mm f1.7
DSCF3211.JPG: SMC PENTAX-M 50mm f1.7
DSCF3212.JPG: SMC PENTAX-M 50mm f1.7
DSCF3213.JPG: SMC PENTAX-M 50mm f1.7
...

Adjusting lens data files

LENS SERIAL NUMBERS

Exif.Photo.LensSerialNumber value is not added to the files, but I do use them and set my lensses serial number. Add to lens config files if you want! The format is:

set Exif.Photo.LensSerialNumber 1234567890

FOCAL LENGTH MULTIPLIER

Exif.Photo.FocalLengthIn35mmFilm value depends on your camera, but the default values in these files are set for FUJIFILM APSC 1.5x multiplier. If you have a full frame camera, you must recalculate with 1. If you have M4/3, you use 2. Either you can use the -c 1.5 switch on command line, or you can chagne the lens config files. Example:

Exif.Photo.FocalLength 20000/100
Exif.Photo.FocalLengthIn35mmFilm 300

This 300 comes from 200mm lens with 1.5x multiplier (APSC crop sensor). You may need to update this value to 200 or 400 in the cases mentioned above. YMMW.

Also my files contain the values for:

set Exif.Fujifilm.MinFocalLength 20000/100
set Exif.Fujifilm.MaxFocalLength 20000/100
set Exif.Fujifilm.MaxApertureAtMinFocal 400/100
set Exif.Fujifilm.MaxApertureAtMaxFocal 400/100

which is not inlcuded in the release pack. Please check if your camera saves  the focal length of manual lensses, if yes, it's recommended to update those to the correct value using maker dependent EXIF values. More help:

http://www.exiv2.org/metadata.html

Creating lens data files

I've included a HTML file in the pack that you can use to generate lens data files. Or use it from my website https://lion.xaraya.hu/lensset-maker.html

(There is more info in README.txt about manually creating your own data files.)

Links

Current version download: lensset-1.4

About me

Photo of me Ferenc Veres
web developer
about me

Commodore books
Commodore logo My C64 and Plus/4 book collection (Hungarian): Commodore könyvek
Featured article

Exisitng editors for text data DjVu files are quite limited, like for example DjVuSmooth. So I've implemented a new editor in JavaScript, that allows editing both the strucutre of the text (paragraphs, lines, words,...) and the coordinates of the text boxes by simply dragging with the mouse, features like create, delete, merge are also available.

My other websites
Categories