Hi,
I am discovering exiftool and I try to undestand. (apologize for my english, I am french).
I have a Sigma 8-16mm F4.5-5.6 DC HSM on a Pentax K7.
I have two problems :
- The name of the lens is not reported. In Exiftool I have Lens Type : Unknow (8 18)
- The focal lengh under 10 mm is not reported by the Pentax body, the indication is ---mm . In Exiftool I found for exemple FocalLength=8.1mm.
For focal lengh I used ExifTool Gui and I edit the Exif to introduce the focal lengh value. It work correctly in Lightroom and I can apply lens corrections
Is there a solution for the name ?
Thanks for reporting this new Pentax LensType (https://exiftool.org/TagNames/Pentax.html#LensType) value:
'8 18' = Sigma 8-16mm F4.5-5.6 DC HSM
I will add this to the list, and ExifTool 8.43 (when released) should properly report this lens.
- Phil
Edit: I just took a look at the specs for this lens. Nice. I didn't know you could get a rectilinear lens this wide. I really like my Sigma 10-20mm on the K-5, but this lens goes even wider! :)
Great thanks !
Any idea for focal lenght ? Any other solution ?
I send mail to Pentax, they said that it is not their responsability, it is the responsability of Sigma.
Same response from Sigma.
Other question : what's about database of Lightroom ? Did they use your database ?
Quote from: gwinru on December 13, 2010, 01:07:26 PM
Any idea for focal lenght ? Any other solution ?
If Pentax:FocalLength is correct, but EXIF:FocalLength is missing, you can use exiftool to fill in the EXIF:FocalLength:
exiftool -if 'not $exif:focallength' '-focallength<pentax:focallength' DIRwhere
DIR is the name of a directory containing the images. Note: On Windows, use double quotes instead of single quotes around the arguments.
Quote
I send mail to Pentax, they said that it is not their responsability, it is the responsability of Sigma.
Same response from Sigma.
Typical. I don't think this is something that Sigma could fix. Pentax has no motivation to support Sigma lenses, but they would have to fix this if the ever came out with an 8mm lens.
Quote
Other question : what's about database of Lightroom ? Did they use your database ?
I don't know if Adobe is using my lens database, but it wouldn't surprise me if they do. However, their update time is a bit slower than mine.
- Phil
Concerning focal length, to be exact the EXIF is not empty, it show :
FocalLength : 0.0 mm
I think I had to modify your code for remplacing value, could you help me ?
You could try something like this:
exiftool -if '$exif:focallength# < 8' ...
Again, use double quotes in Windows. The # extracts the numerical value for the tag so we can test it with the numerical less-than operator (<).
- Phil
Hi Harvey,
Don't work.
The problem seem to be there is two value Pentax:focallength
The response at the command :
exiftool -a -Pentax:focallength XXXXX.PEF
Focallength : 0.0 mm
Focallength : 8.1 mm
How can I use the good tag ?
JP
PS : the Sigma 8-16 is a fabulous lens. Image is rectilinear and Lightroom has corrections. It's a new lens for me and I hope greats images with it.
PS2 : Does the K5 have the same problem with focallength under 10mm ?
Hi JP,
Use the -G4 option to figure out which copy of FocalLength you want to use, then specify this tag in your command:
> exiftool ../pics/PentaxK-7.jpg -focallength -G4:1
[ExifIFD] Focal Length : 24.0 mm
[Copy1:Pentax] Focal Length : 24.0 mm
[Copy2:Pentax] Focal Length : 23.8 mm
> exiftool ../pics/PentaxK-7.jpg -if '$copy2:focallength < 8' ...
I don't know if the K-5 has problems with focal lengths less than 10mm because the 10-20mm is my widest lens.
- Phil
Working.
Great thanks.
With the 8.43 it will be fantastic.
Jean-Paul
Hi Harvey,
I recently purchased the Sigma 8-16 along with the Pentax K-5 and found myself unable to correct the lens distortion in Lightroom 3 for anything under 10 mm focal length, which brought me to this forum (and many others). The issue is well documented, and everyone has gotten so close to figuring it out without actually posting any efficient work-arounds (that I have found). I think I've got it, with the help of your excellent ExifTool! But before I post it on other forums, I am hoping you can help me make it as elegant and efficient as possible. It turns out that Lightroom not only needs to be able to read the focal length, it also needs the 35 mm equivalent focal length. The lens correction only works when Lightroom can read both. So I have come up with a two step process (building on others work). (I am running OS X 10.6.8 and using Automator, so I've left out the directories.)
1. Fill appropriate Focal Length field: exiftool '-focallength<$copy2:focallength' -if '$focallength# == 0.0' "$f"
2. Manually calculate 35mm equivalent based on specific focal lengths and fill that field: exiftool -if '$focallength# == 8.1' -overwrite_original -FocalLengthIn35mmFormat='12.2' "$f"
I am not a programmer and have tried in vain to create a one step process where I can also fill the 35mm equivalent field based on the focal length and 1.5x sensor to 35mm factor. Is there a way to make this a one step process?
Thank you,
Christopher Weber
Hi Christopher,
I think I can do what you want with 2 commands:
exiftool -focallengthin35mmformat= -focalplanexresolution=5206 -focalplaneyresolution=5206 -focalplaneresolutionunit=inches '-focallength<$copy2:focallength' -if '$focallength# == 0' FILE
exiftool '-focallengthin35mmformat<focallength35efl#' -if 'not $focallengthin35mmformat' FILE
This takes advantage of the FocalLength35efl tag that Exiftool calculates from the other tags set in the first command. I don't know what the exact sensor resolution is, but I've used 5206 because it gives me the 1.5 crop factor that I want (for full-sized K-5 images that is).
Be sure to mention that they must use double quotes instead of single quotes in the commands if run in Windows.
- Phil
Edit: These commands are a big lengthy, so using an argument file may make things easier:
exiftool -@ fixfocal.args -common_args FILE
with this "fixfocal.args" file:
-focallengthin35mmformat=
-focalplanexresolution=5206
-focalplaneyresolution=5206
-focalplaneresolutionunit=inches
-focallength<$copy2:focallength
-if
$focallength# == 0
-execute
-focallengthin35mmformat<focallength35efl#
-if
not $focallengthin35mmformat
Hi Phil, (I apologize for addressing you by your last name yesterday :-[ )
Thanks for responding so quickly. I was finally able to test it out and got your 2 commands to work beautifully! That definitely saves time from my manual 35mm format calculations.
The sensor size is actually 4992 and cropped to 4928 for the RAW file on the K-5. I know the actual crop factor is not exactly 1.5, but that is the standard everyone uses and probably the basis for how the Lightroom lens correction profiles were determined, so I will stick with your 5206.
I am still trying to get the argument file to work, but I need to work on some other things right now, so I will have to come back to it. I just wanted to get back and say thank you for helping out with this. Hopefully, we will make some fellow Pentaxians happy with this solution!
Cheers,
Christopher
Hi Christopher, (no need to apologize)
After my last post I noticed that the Pentax cameras write SensorSize information. From this I can calculate the scaling factor much more directly (from this one tag, instead of requiring 5 tags: FocalPlaneXResolution, FocalPlaneYResolution, FocalPlaneResolutionUnit, ImageWidth and ImageHeight).
So just for fun I will incorporate SensorSize into the scaling factor calculation of ExifTool 8.73 (to be released tomorrow). With this new version, the first command will be much simpler:
exiftool -focallengthin35mmformat= '-focallength<$copy2:focallength' -if '$focallength# == 0' FILE
exiftool '-focallengthin35mmformat<focallength35efl#' -if 'not $focallengthin35mmformat' FILE
But note that this will not work for ExifTool 8.72 or earlier.
I think the SensorSize may actually include some black border pixels, but it gives a scaling factor of 1.49542, which is pretty close.
- Phil
Quote from: Phil Harvey on December 16, 2011, 01:14:17 PM
exiftool -focallengthin35mmformat= '-focallength<$copy2:focallength' -if '$focallength# == 0' FILE
exiftool '-focallengthin35mmformat<focallength35efl#' -if 'not $focallengthin35mmformat' FILE
But note that this will not work for ExifTool 8.72 or earlier.
I've tried this with 8.74 and there seems to be an error in the calculation.
From an image shot with a pentax lens I get:
exiftool /mnt/karte/DCIM/108_2612/IMGP4905.JPG -G4:1| grep oca
[ExifIFD] Focal Length : 35.0 mm
[ExifIFD] Focal Length In 35mm Format : 52 mm
[Pentax] World Time Location : Hometown
[Pentax] SR Focal Length : 35 mm
[Composite] Focal Length : 35.0 mm (35 mm equivalent: 52.0 mm)
From an image shot with the Sigma 4.5mm and corrected as above I get:
xiftool /tmp/IMGP4921.JPG -G4:1| grep oca
[ExifIFD] Focal Length : 5.0 mm
[ExifIFD] Focal Length In 35mm Format : 5 mm
[Pentax] World Time Location : Hometown
[Pentax] SR Focal Length : 10 mm
[Composite] Focal Length : 5.0 mm (35 mm equivalent: 5.0 mm)
[Composite] Hyperfocal Distance : 0.15 m
The 35mm value should be 7.5mm not 5mm, I think.
This is a on a Pentax K10D which has an APS-C sensor. Bug or user error?
Cheers,
Gerhard
Hi Gerhard,
Was the EXIF:FocalLength equal to 0 before you processed the file? After the 1st command, what were the values of all tags that contribute to the scale factor calculation?:
FocalLength
FocalLengthIn35mmFormat
Composite:DigitalZoom
FocalPlaneDiagonal
SensorSize
FocalPlaneXSize
FocalPlaneYSize
FocalPlaneResolutionUnit
FocalPlaneXResolution
FocalPlaneYResolution
ExifImageWidth
ExifImageHeight
CanonImageWidth
CanonImageHeight
ImageWidth
ImageHeight
- Phil
Hi Phil!
Quote from: Phil Harvey on January 02, 2012, 07:22:02 PM
Was the EXIF:FocalLength equal to 0 before you processed the file?
exiftool /mnt/karte/DCIM/108_2612/IMGP4921.JPG -G4:1| grep oca
[ExifIFD] Focal Length : 0.0 mm
[ExifIFD] Focal Length In 35mm Format : 0 mm
[Pentax] World Time Location : Hometown
[Pentax] SR Focal Length : 10 mm
[Composite] Focal Length : 0.0 mm
Yes.
What is strange is that [Pentax] SR Focal Length is 10mm.
Maybe that is because the Pentax only records Focal Length down to 10mm?
Quote
After the 1st command, what were the values of all tags that contribute to the scale factor calculation?:
FocalLength
FocalLengthIn35mmFormat
Composite:DigitalZoom
FocalPlaneDiagonal
SensorSize
FocalPlaneXSize
FocalPlaneYSize
FocalPlaneResolutionUnit
FocalPlaneXResolution
FocalPlaneYResolution
ExifImageWidth
ExifImageHeight
CanonImageWidth
CanonImageHeight
ImageWidth
ImageHeight
- Phil
cp /mnt/karte/DCIM/108_2612/IMGP4921.JPG /tmp/IMGP4921_2.JPG
exiftool -focallengthin35mmformat= '-focallength<$copy2:focallength' -if '$focallength# == 0' /tmp/IMGP4921_2.JPG
Focal Length : 5.0 mm
FocalLengthIn35mmFormat doesn't seem to exist
Composite:DigitalZoom doesn't seem to exist
FocalPlaneDiagonal doesn't seem to exist
SensorSize doesn't seem to exist
FocalPlaneXSize doesn't seem to exist
FocalPlaneYSize doesn't seem to exist
FocalPlaneResolutionUnit doesn't seem to exist
FocalPlaneXResolution doesn't seem to exist
FocalPlaneYResolution doesn't seem to exist
ExifImageWidth
Exif Image Width : 3872
ExifImageHeight
Exif Image Height : 2592
CanonImageWidth doesn't seem to exist
CanonImageHeight doesn't seem to exist
ImageWidth 3872
ImageHeight 2592
So I guess presence of various of these items depends on the camera
model and my K10D is just too old.
Wouldn't it be possible to determine the focal length based on the
lense model alone? It is a prime lense after all.
I have already configured the lense in .ExifTool_config's
UserDefined::Lenses.
Cheers,
Gerhard
Hi Gerhard,
It appears that the K10D doesn't store the SensorSize information that is needed for the technique you were using. So instead, for the K10D you will need to set the FocalPlaneResolution tags appropriately as per the previous technique I detailed in this thread.
- Phil
Hi Phil!
I've been doing now:
exiftool -focallengthin35mmformat= -focalplanexresolution=5206 -focalplaneyresolution=5206 -focalplaneresolutionunit=inches '-focallength<$copy2:focallength' -if '$focallength# == 0' IMGP4921.JPG
exiftool '-focallengthin35mmformat<focallength35efl#' -if 'not $focallengthin35mmformat' IMGP4921.JPG
and the result is
exiftool IMGP4921.JPG -G4:1 | grep ocal
[ExifIFD] Focal Length : 5.0 mm
[ExifIFD] Focal Plane X Resolution : 5206
[ExifIFD] Focal Plane Y Resolution : 5206
[ExifIFD] Focal Plane Resolution Unit : inches
[ExifIFD] Focal Length In 35mm Format : 10 mm
[Pentax] SR Focal Length : 10 mm
[Composite] Focal Length : 5.0 mm (35 mm equivalent: 10.0 mm)
[Composite] Hyperfocal Distance : 0.30 m
I beliee that is still wrong: the focal length of the lense should be 4.5mm and the 35mm equivalent then 6.75mm.
I probably need different numbers of the resolution values.
I tried the value 3782 which is the max # of pixels:
[ExifIFD] Focal Length : 5.0 mm
[ExifIFD] Focal Plane X Resolution : 3872
[ExifIFD] Focal Plane Y Resolution : 3872
[ExifIFD] Focal Plane Resolution Unit : inches
[ExifIFD] Focal Length In 35mm Format : 7 mm
[Pentax] SR Focal Length : 10 mm
[Composite] Focal Length : 5.0 mm (35 mm equivalent: 7.0 mm)
[Composite] Hyperfocal Distance : 0.21 m
this is better. Is the focal length always an integer?
Cheers,
Gerhard
Hi Gerhard,
Yes, the K10D will have a different focal plane resolution, but it isn't simply the number of pixels. It is the number of pixels divided by the size of the sensor in inches. (The sensor pitch in pixels per inch.)
FocalLength is rational64u (https://exiftool.org/TagNames/EXIF.html) (rational, 64-bit, unsigned), so it supports non-integral values.
- Phil
Hello,
I am trying to specifically change the focal length of my Pentax K5 dng files, but only when it is the Sigma 8-16mm lens and focal length = 0.
The problem is the AND in the if expression. I am not familiar with Perl and I cannot find a good tutorial.
The command line (dos) is : exiftool -@ Sigma816.txt -common-args -overwrite-original-in-file -P file.dng
the argfile is
-focallengthin35mmformat=
-focalplanexresolution=5206
-focalplaneyresolution=5206
-focalplaneresolutionunit=inches
-focallength<$copy2:focallength
-if $lenstype# == 8 18 AND $focallength# == 0
-execute
-focallengthin35mmformat<focallength35efl#
-if not $focallengthin35mmformat
The error is :
No file specified
1 image files updated
But no change in the exif...
Frederic
Hi Frederic,
Try this:
-if
$lenstype# eq '8 18' and $focallength# == 0
Note that the -if argument must be on a separate line in the argfile.
- Phil
Thank you !
I tried this
-focallengthin35mmformat=
-focalplanexresolution=5206
-focalplaneyresolution=5206
-focalplaneresolutionunit=inches
-focallength<$copy2:focallength
-if
$lenstype# eq '8 18' and $focallength# == 0
-execute
-focallengthin35mmformat<focallength35efl#
-if
not $focallengthin35mmformat
but now the error is :
No file specified
1 files failed condition
Frederic
Hi Frederic,
Check your spelling of the -common_args and -overwrite_original_in_place option names. (Make sure you use underlines.)
- Phil
I am confused ! Thank you so much ! it works !
Frederic