Workaround for Sigma 8-16mm requested

Started by linuxuser, September 18, 2014, 03:26:02 PM

Previous topic - Next topic

linuxuser

There is a known bug for the Sigma 8-16mm F4.5-5.6 DC HSM, below 10mm the focal length is zero, but a workaround can be coded. Maybe there should be a fix through exiftool?

[EXIF]          0x920a Focal Length                    : 0.0 mm
[EXIF]          0xa405 Focal Length In 35mm Format     : 0 mm
[MakerNotes]    0x001d Focal Length                    : 0.0 mm
[Composite]          - Focal Length                    : 0.0 mm (35 mm equivalent: 0.0 mm)


There is 2nd field with Focal Length in the makernotes:

[MakerNotes]    0x0009 Focal Length                    : 8.1 mm

How can I get the value of 0x0009?

Similar is this:

[MakerNotes]    0x0000 Lens Type                       : Sigma 8-16mm F4.5-5.6 DC HSM
[MakerNotes]    0x0001 Lens Type                       : Sigma 8-16mm F4.5-5.6 DC HSM
[Composite]          - Lens ID                         : Sigma 8-16mm F4.5-5.6 DC HSM


But that is not actually a problem.

If you need a sample let me know.

Phil Harvey

#1
Try this to fix the metadata in these files:

exiftool -n '-focallength<copy1:focallength' -if '$focallength==0 and $copy1:focallength!=0' FILE

where FILE is one or more file and/or directory names.  (The above quoting is for Mac/Linux.  Windows users would need double quotes.)

I think this should work, but I can't test it without a sample.

- Phil

Edit: If "copy1" doesn't work, try "copy2".  Use this command to see which:

exiftool -a -G4 -focallength FILE
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

linuxuser

#2
Sorry, I was away and I have troubles with my internet too. I will send you a sample ASAP. Thanks!

linuxuser

Please check your mails, I have sent to you:
Subject: Sample files  - Workaround for Sigma 8-16mm requested
Date: Wed, 24 Sep 2014 19:29:46 +0200

The sample files contain photos in PEF-format with these focal lengths:

8.1 mm
8.8 mm
9.4 mm
10.0 mm
10.6 mm
11.2 mm
11.9 mm
13.1 mm
13.8 mm
15.0 mm
16.2 mm

10mm is ok, but below the focal length is missing with exif.

What I would need is a variable vor a bash-script with the correct focal length, which can be used later to write more new exif-data. The condtion, if the focal length is 0, I would set with my own script, except you correct this with exiftool automatically. If you check the web, this is a general problem with this lens.


exiftool -a -G4 -focallength 10.0_mm.pef
[]              Focal Length                    : 10.0 mm
[Copy1]         Focal Length                    : 10.0 mm
[Copy2]         Focal Length                    : 10.0 mm


Thanks for having a look into it!

Phil Harvey

I haven't got the mails yet.  I'll let you know when I receive them, but if it isn't soon I'll have to take a look at them tomorrow.  The queensu mailserver implements a grey list that often delays mails by an hour or so.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

I got your files.  The command I suggested works if you change "copy1" to "copy2" in both arguments.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

linuxuser

Quote from: Phil Harvey on September 24, 2014, 02:01:33 PM
I got your files.  The command I suggested works if you change "copy1" to "copy2" in both arguments.

- Phil

Phil, could you please give me the syntax to get the focal length as a bash-variable, as mentioned before? I don't need / want to use copy

I mean something like this:
exiftool -s -s -s -n -focallength 8.1_mm.pef
0


But the result should be 8.1

Phil Harvey

#7
exiftool -s -s -s -n -copy2:focallength 8.1_mm.pef

Edit: Removed unnecessary -a option from command.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


linuxuser

I was so happy that it worked, so I forget to ask, that I understand this syntax better.

I always thought, that I have to use something like  -MAKERNOTES:focallength, but you use -a

exiftool -s -s -s -n -a -focallength 8.1_mm.pef
0
0
8.125


exiftool -s -s -s -n -a -makernotes:focallength 8.1_mm.pef
0
8.125


I still don't understand why it is copy2. Can this be found out with trial and error only?


Phil Harvey

It is copy2 because it is the 3rd tag extracted with the same name.  To figure out which one is correct for an image, use -a -G4 when extracting.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

linuxuser

Now I understand, the 1st match is the original and doesn't count for copy. Thanks!

linuxuser

#12
Not using exiftool 10.40.

I think there was a change with exiftool so the above doesn't work anymore. It could be a longer time ago, since I don't use an 8mm lens very often.

ExifTool Version Number         : 10.40

exiftool -H -a -G4 original.pef | grep -i focal
[]              0x001d Focal Length                    : 0.0 mm
[]              0x0003 SR Focal Length                 : 10 mm
[]              0x0009 Lens Focal Length               : 8.1 mm
[]              0xa405 Focal Length In 35mm Format     : 0 mm
[]                   - Focal Length                    : 0.0 mm (35 mm equivalent: 0.0 mm)
[]                   - Hyperfocal Distance             : 0.00 m


exiftool -a -G -H original.pef | grep -i focal
[EXIF]          0xa405 Focal Length In 35mm Format     : 0 mm
[MakerNotes]    0x001d Focal Length                    : 0.0 mm
[MakerNotes]    0x0003 SR Focal Length                 : 10 mm
[MakerNotes]    0x0009 Lens Focal Length               : 8.1 mm
[Composite]          - Focal Length                    : 0.0 mm (35 mm equivalent: 0.0 mm)



exiftool -a -G4 -H original.pef | grep -i copy
[Copy1]         0x8827 ISO                             : 400
[Copy1]         0x9204 Exposure Compensation           : +0.7
[Copy1]         0x9207 Metering Mode                   : Multi-segment
[Copy1]         0x0012 Exposure Time                   : 1/160
[Copy1]         0x0013 F Number                        : 8.0
[Copy1]         0x001f Saturation                      : 0 (normal)
[Copy1]         0x0020 Contrast                        : 0 (normal)
[Copy1]         0x0021 Sharpness                       : 0 (normal)
[Copy1]         0x0001 EV Steps                        : 1/3 EV Steps
[Copy1]         0x000e Sensitivity Steps               : As EV Steps
[Copy1]         0x0001 Lens Type                       : Sigma 8-16mm F4.5-5.6 DC HSM
[Copy1]         0x0000 Pentax Model ID                 : K-5 II
[Copy1]         0xa403 White Balance                   : Auto
[Copy1]         0x0100 Image Width                     : 160
[Copy1]         0x0101 Image Height                    : 120
[Copy1]         0x0103 Compression                     : JPEG (old-style)
[Copy1]         0x011a X Resolution                    : 300
[Copy1]         0x011b Y Resolution                    : 300
[Copy1]         0x0128 Resolution Unit                 : inches
[Copy2]         0x0100 Image Width                     : 4928
[Copy2]         0x0101 Image Height                    : 3264
[Copy2]         0x0103 Compression                     : JPEG (old-style)
[Copy2]         0x011a X Resolution                    : 300
[Copy2]         0x011b Y Resolution                    : 300
[Copy2]         0x0128 Resolution Unit                 : inches



In a bash-script the variable is empty

EXIFFOCALLENGTH_APS=`exiftool -s -s -s -n -a -copy2:focallength "$TEMPFILE"`

Phil Harvey

Sorry for the inconvenience; a few Pentax tags were renamed in ExifTool 10.01.  Now things are better and you can just use "LensFocalLength" (a more robust solution than relying on a specific copy number).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

linuxuser

Thanks, and sorry I didn't notice the change of the tags. It works again. Which other Pentax-Tags have been renamed? Maybe you have a link? http://www.exiftool.org/TagNames/Pentax.html shows all tags.

BTW Phil, did you test samples from the new Pentax KP already? http://www.us.ricoh-imaging.com/index.php/cameras/pentax-kp