The lensfun tab in UFraw does not read the distance information for Nikon lenses, because the .NEF files do not record a value for SubjectDistance in the EXIF data. But the information is in there – only not in a standard way.
In some circumstances the subject distance is essential for lens corrections. Then you have to enter the value by hand. mac has written a script that can extract the distance information under Linux and perhaps MacOS.
When you run the script by typing FD in a terminal, it asks you for the full path to the folder where your image files are. It then prints the file names and their focus distances to a file called FocusDistances.txt in the same folder as the images.
As usual, you have to copy the script as root or with “sudo” to /usr/local/bin and make it executable. It also assumes you have exiftools installed.
And here is the script:
#!/bin/sh
# This script prints the focus distance for all image files in the specified folder
# to an output file called 'FocusDistances.txt' in the same folder
echo ""
echo "~*~*~*~*~*~*~*~*~*~*~*~*~*"
echo "Extract Focus Distance information"
echo "~*~*~*~*~*~*~*~*~*~*~*~*~*"
echo ""
echo
echo -n "Enter path to directory with the images, and press Enter"
echo
echo
read directoryname
exiftool -p '$filename Focus Distance = $FocusDistance' $directoryname > /$directoryname/FocusDistances.txt
echo ""
echo "~*~*~*~*~*~*~*~*~*~*~*~*~*"
echo "All done!"
echo ""
echo -n " Press any key to finish…"
echo
read answer
exit 0
# Save this script as "FD", and, as root, copy it to /usr/local/bin/
# To use it, type "FD", enter the full path to the source directory, press ENTER
# and wait for the script to finish. Press any key to continue.
# Last updated 14/7/2010
As you can see by the date this has sat on my mail account for quite a while nd mac had to remind me of posting it. So if I have promised you something, just drop me a line. There was so much to think of here recently that I tend to forget stuff.
The lensfun tab in UFraw does not read the distance information for Nikon lenses, because the .NEF files do not record a value for SubjectDistance in the EXIF data. But...