From 511659809b842854b1a352cf4e8520e7cd465e7b Mon Sep 17 00:00:00 2001 From: norbertwg Date: Tue, 15 Nov 2022 13:35:16 +0100 Subject: [PATCH] add two lens tags to EasyAccess API Exif.Photo.LensSpecification and Exif.Nikon3.Lens --- src/easyaccess.cpp | 29 +++++++++++---- src/nikonmn_int.cpp | 3 +- tests/bash_tests/test_easyaccess.py | 58 +++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 8 deletions(-) diff --git a/src/easyaccess.cpp b/src/easyaccess.cpp index eb07ea5e..74f3c3f0 100644 --- a/src/easyaccess.cpp +++ b/src/easyaccess.cpp @@ -230,13 +230,28 @@ ExifData::const_iterator whiteBalance(const ExifData& ed) { } ExifData::const_iterator lensName(const ExifData& ed) { - static const char* keys[] = { - // Try Exif.CanonCs.LensType first. - "Exif.CanonCs.LensType", "Exif.Photo.LensModel", "Exif.Canon.LensModel", "Exif.NikonLd1.LensIDNumber", - "Exif.NikonLd2.LensIDNumber", "Exif.NikonLd3.LensIDNumber", "Exif.NikonLd4.LensID", "Exif.NikonLd4.LensIDNumber", - "Exif.Pentax.LensType", "Exif.PentaxDng.LensType", "Exif.Minolta.LensID", "Exif.SonyMinolta.LensID", - "Exif.Sony1.LensID", "Exif.Sony2.LensID", "Exif.Sony1.LensSpec", "Exif.Sony2.LensSpec", - "Exif.OlympusEq.LensType", "Exif.Panasonic.LensType", "Exif.Samsung2.LensType"}; + static const char* keys[] = {// Try Exif.CanonCs.LensType first. + "Exif.CanonCs.LensType", + "Exif.Photo.LensModel", + "Exif.Canon.LensModel", + "Exif.NikonLd1.LensIDNumber", + "Exif.NikonLd2.LensIDNumber", + "Exif.NikonLd3.LensIDNumber", + "Exif.NikonLd4.LensID", + "Exif.NikonLd4.LensIDNumber", + "Exif.Pentax.LensType", + "Exif.PentaxDng.LensType", + "Exif.Minolta.LensID", + "Exif.SonyMinolta.LensID", + "Exif.Sony1.LensID", + "Exif.Sony2.LensID", + "Exif.Sony1.LensSpec", + "Exif.Sony2.LensSpec", + "Exif.OlympusEq.LensType", + "Exif.Panasonic.LensType", + "Exif.Samsung2.LensType", + "Exif.Photo.LensSpecification", + "Exif.Nikon3.Lens"}; for (size_t i = 0; i < std::size(keys); ++i) { Exiv2::ExifData::const_iterator pos = ed.findKey(ExifKey(keys[i])); diff --git a/src/nikonmn_int.cpp b/src/nikonmn_int.cpp index cb339def..95528247 100644 --- a/src/nikonmn_int.cpp +++ b/src/nikonmn_int.cpp @@ -441,7 +441,8 @@ constexpr TagInfo Nikon3MakerNote::tagInfo_[] = { SectionId::makerTags, asciiString, -1, printValue}, {0x0083, "LensType", N_("Lens Type"), N_("Lens type"), IfdId::nikon3Id, SectionId::makerTags, unsignedByte, -1, print0x0083}, - {0x0084, "Lens", N_("Lens"), N_("Lens"), IfdId::nikon3Id, SectionId::makerTags, unsignedRational, -1, printLensSpecification}, + {0x0084, "Lens", N_("Lens"), N_("Lens"), IfdId::nikon3Id, SectionId::makerTags, unsignedRational, -1, + printLensSpecification}, {0x0085, "FocusDistance", N_("Focus Distance"), N_("Manual focus distance"), IfdId::nikon3Id, SectionId::makerTags, unsignedRational, -1, print0x0085}, {0x0086, "DigitalZoom", N_("Digital Zoom"), N_("Digital zoom setting"), IfdId::nikon3Id, SectionId::makerTags, diff --git a/tests/bash_tests/test_easyaccess.py b/tests/bash_tests/test_easyaccess.py index 4a156a41..b739bc0b 100644 --- a/tests/bash_tests/test_easyaccess.py +++ b/tests/bash_tests/test_easyaccess.py @@ -183,6 +183,64 @@ Del Exif.Photo.ISOSpeedRatings stderr = [""] * len(commands) retval = [0] * len(commands) +########################################################### +# FUJIFILM X-T3 +########################################################### +@CopyTmpFiles("$data_path/FujiTagsDRangeAutoRating1.jpg") +class Canon2(metaclass=CaseMeta): + + filename = path("$tmp_path/FujiTagsDRangeAutoRating1.jpg") + + commands = [ + "$easyaccess_test $filename", + """$exiv2 -u -v -M"del Exif.Photo.LensModel" $filename""", + "$easyaccess_test $filename LensName" + ] + stdout = [ + """Orientation (Exif.Image.Orientation ) : top, left +ISO speed (Exif.Photo.ISOSpeedRatings ) : 800 +Date & time original ( ) : +Flash bias ( ) : +Exposure mode (Exif.Photo.ExposureProgram ) : Manual +Scene mode (Exif.Fujifilm.PictureMode ) : Manual +Macro mode ( ) : +Image quality (Exif.Fujifilm.Quality ) : NORMAL +White balance (Exif.Fujifilm.WhiteBalance ) : Auto +Lens name (Exif.Photo.LensModel ) : XF50mmF2 R WR +Saturation (Exif.Fujifilm.Color ) : 0 (normal) +Sharpness (Exif.Photo.Sharpness ) : Normal +Contrast ( ) : +Scene capture type (Exif.Photo.SceneCaptureType ) : Standard +Metering mode (Exif.Photo.MeteringMode ) : Multi-segment +Camera make (Exif.Image.Make ) : FUJIFILM +Camera model (Exif.Image.Model ) : X-T3 +Exposure time (Exif.Photo.ExposureTime ) : 1/8000 s +FNumber (Exif.Photo.FNumber ) : F2 +Shutter speed value (Exif.Photo.ShutterSpeedValue ) : 1/8192 s +Aperture value (Exif.Photo.ApertureValue ) : F2 +Brightness value (Exif.Photo.BrightnessValue ) : 2.53 +Exposure bias (Exif.Photo.ExposureBiasValue ) : 0 EV +Max aperture value (Exif.Photo.MaxApertureValue ) : F2 +Subject distance ( ) : +Light source (Exif.Photo.LightSource ) : Unknown +Flash (Exif.Photo.Flash ) : No flash +Camera serial number ( ) : +Focal length (Exif.Photo.FocalLength ) : 50.0 mm +Subject location/area ( ) : +Flash energy ( ) : +Exposure index ( ) : +Sensing method (Exif.Photo.SensingMethod ) : One-chip color area +AF point ( ) : +""", + """File 1/1: $filename +Del Exif.Photo.LensModel +""", + """Lens name (Exif.Photo.LensSpecification ) : 50mm F2 +""" + ] + stderr = [""] * len(commands) + retval = [0] * len(commands) + ########################################################### # Nikon D1 ###########################################################