drewnoakes / metadata-extractor-dotnet

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PENTAX / RICOH Support

skorpionet100 opened this issue · comments

Hi,

is possible to add the full support to the PENTAX / RICOH tags? I can provide JPG and PEF (Pentax RAW format) samples from here: https://www.wificommanderpentax.com/temp/PENTAX_IMAGES_TAGS.zip
To have a list of the PENTAX / RICOH tags go here: https://exiftool.org/TagNames/Pentax.html

Thanks

Hi,
@drewnoakes , I can accept your propose to try and do that myself. Please share with me any useful information to accomplish this task.

Thanks

@skorpionet100 sure, I'll be happy to guide you.

First, I assume this information is stored in a "makernote". These are areas in TIFF data where manufacturers can store data specific to their devices. Note that both Exif and raw files use TIFF encoding.

Some more general information about makernotes here: https://github.com/drewnoakes/metadata-extractor/wiki/Makernotes

We already have a PentaxMakernoteDirectory class and a RicohMakernoteDirectory. You may be able to extend those. In some cases, manufacturers have multiple versions of makernotes across devices. In such cases, we create different directories for each.

Let me know if you have any questions.

Also, are you able and willing to donate those sample images to this project? Are they your original images?

Also, are you able and willing to donate those sample images to this project? Are they your original images?

Sure and are my original images.

I took a quick look at this for you. This should help:

diff --git a/MetadataExtractor/Formats/Exif/ExifTiffHandler.cs b/MetadataExtractor/Formats/Exif/ExifTiffHandler.cs
index bb52ae82..e14b368d 100644
--- a/MetadataExtractor/Formats/Exif/ExifTiffHandler.cs
+++ b/MetadataExtractor/Formats/Exif/ExifTiffHandler.cs
@@ -707,6 +707,11 @@ namespace MetadataExtractor.Formats.Exif
                     // Always in Motorola byte order
                     TiffReader.ProcessIfd(this, context.WithByteOrder(isMotorolaByteOrder: true).WithShiftedBaseOffset(makernoteOffset), 8);
                 }
+                else if (firstTenChars.Equals("PENTAX \0II", StringComparison.Ordinal))
+                {
+                    PushDirectory(new PentaxMakernoteDirectory()); // TODO use the correct directory class here
+                    TiffReader.ProcessIfd(this, context.WithByteOrder(isMotorolaByteOrder: false).WithShiftedBaseOffset(makernoteOffset), 10);
+                }
             }
             else if (string.Equals(firstTenChars, "Apple iOS\0", StringComparison.Ordinal))
             {

The use of PentaxMakernoteDirectory here is just to get things working. I think the schema of values here is new, so you'll need to create a new set of classes as described in the linked wiki page above.

Good luck!

There may also be a "PENTAX \0MM" form where isMotorolaByteOrder: true.

This might be helpful too: https://exiv2.org/tags-pentax.html

Hi,

can I use VS 2022? The correct way to get the code is to clone the github repository?

Thanks

@skorpionet100 yes, sorry I missed your message. VS2022 and a git clone will get you started. Create a fork of this repo, clone that to your machine, create a new branch, commit your changes, push to your fork, create a pull request here. That's the general process. You can find nice docs online to walk you through the process if you're new to it.

I put basic support for this in #321.

What remains extending the descriptor class in order to show decoded values for many of the tags.

Here's an example from Pentax K-1 Mark II.jpg:

[Pentax Makernote - 0x0000] PentaxVersion = 12 3 2 0
[Pentax Makernote - 0x0001] PentaxModelType = 0
[Pentax Makernote - 0x0005] PentaxModelId = 78400
[Pentax Makernote - 0x0006] Date = 7 228 7 11
[Pentax Makernote - 0x0007] Time = 4 58 13
[Pentax Makernote - 0x0008] Quality = 2
[Pentax Makernote - 0x000c] FlashMode = 1 63
[Pentax Makernote - 0x000d] FocusMode = 3
[Pentax Makernote - 0x000e] AFPointSelected = 0 0
[Pentax Makernote - 0x0012] ExposureTime = 3333
[Pentax Makernote - 0x0013] FNumber = 71
[Pentax Makernote - 0x0014] Iso = 24
[Pentax Makernote - 0x0016] ExposureCompensation = 50 0
[Pentax Makernote - 0x0017] MeteringMode = 0
[Pentax Makernote - 0x0018] AutoBracketing = 0 0
[Pentax Makernote - 0x0019] WhiteBalance = 1
[Pentax Makernote - 0x001d] FocalLength = 6000
[Pentax Makernote - 0x001f] Saturation = 1
[Pentax Makernote - 0x0020] Contrast = 4
[Pentax Makernote - 0x0021] Sharpness = 1
[Pentax Makernote - 0x0027] DSPFirmwareVersion = 254 251 255 248
[Pentax Makernote - 0x002d] EffectiveLV = 4736
[Pentax Makernote - 0x0032] ImageEditing = 2 0 0 0
[Pentax Makernote - 0x0033] PictureMode2 = 8 0 1
[Pentax Makernote - 0x0034] DriveMode = 0 0 1 0
[Pentax Makernote - 0x0037] ColorSpace = 0
[Pentax Makernote - 0x003d] DataScaling = 7679
[Pentax Makernote - 0x003f] LensRec = 8 227 0 0
[Pentax Makernote - 0x0040] SensitivityAdjust = 50
[Pentax Makernote - 0x0041] ImageEditCount = 1
[Pentax Makernote - 0x0047] CameraTemperature = 25
[Pentax Makernote - 0x0048] AELock = 0
[Pentax Makernote - 0x0049] NoiseReduction = 0
[Pentax Makernote - 0x004d] FlashExposureComp = 0 0
[Pentax Makernote - 0x004f] ImageTone = 1
[Pentax Makernote - 0x0050] ColorTemperature = 0
[Pentax Makernote - 0x005c] ShakeReductionInfo = 64 0
[Pentax Makernote - 0x005d] ShutterCount = 252 33 224 54
[Pentax Makernote - 0x0060] FaceInfo = 0 0 0 0
[Pentax Makernote - 0x0062] RawDevelopmentProcess = 16
[Pentax Makernote - 0x0067] Hue = 1
[Pentax Makernote - 0x0068] AWBInfo = 0 1
[Pentax Makernote - 0x0069] DynamicRangeExpansion = 0 2 0 0
[Pentax Makernote - 0x006b] TimeInfo = 6 0 23 23
[Pentax Makernote - 0x006c] HighLowKeyAdj = 0 0
[Pentax Makernote - 0x006d] ContrastHighlight = 2 0
[Pentax Makernote - 0x006e] ContrastShadow = -1 0
[Pentax Makernote - 0x006f] ContrastHighlightShadowAdj = 1
[Pentax Makernote - 0x0070] FineSharpness = 1 2
[Pentax Makernote - 0x0071] HighISONoiseReduction = 0 0
[Pentax Makernote - 0x0072] AFAdjustment = 3
[Pentax Makernote - 0x0073] MonochromeFilterEffect = 65535
[Pentax Makernote - 0x0074] MonochromeToning = 65535
[Pentax Makernote - 0x0076] FaceDetect = 0 0 0
[Pentax Makernote - 0x0077] FaceDetectFrameSize = 720 480
[Pentax Makernote - 0x0078] Unknown tag (0x0078) = 0 0
[Pentax Makernote - 0x0079] ShadowCorrection = 2 4
[Pentax Makernote - 0x007a] ISOAutoParameters = 1 0
[Pentax Makernote - 0x007b] CrossProcess = 0
[Pentax Makernote - 0x007d] LensCorr = 0 0 0 0
[Pentax Makernote - 0x007f] BleachBypassToning = 65535
[Pentax Makernote - 0x0080] AspectRatio = 1
[Pentax Makernote - 0x0085] HDR = 0 0 0 0
[Pentax Makernote - 0x0086] Unknown tag (0x0086) = 0
[Pentax Makernote - 0x0087] ShutterType = 0
[Pentax Makernote - 0x0092] IntervalShooting = 0 0
[Pentax Makernote - 0x0093] Unknown tag (0x0093) = 0
[Pentax Makernote - 0x0095] SkinToneCorrection = 0 0
[Pentax Makernote - 0x0096] ClarityControl = 0 0
[Pentax Makernote - 0x0098] Unknown tag (0x0098) = 1 1 0
[Pentax Makernote - 0x0200] BlackPoint = 1024 1024 1024 1024
[Pentax Makernote - 0x0201] WhitePoint = 17472 8192 8192 13408
[Pentax Makernote - 0x0205] CameraSettings = [40 values]
[Pentax Makernote - 0x0206] AEInfo = [64 values]
[Pentax Makernote - 0x0207] LensInfo = [128 values]
[Pentax Makernote - 0x0208] FlashInfo = [36 values]
[Pentax Makernote - 0x0209] AEMeteringSegments = [4050 values]
[Pentax Makernote - 0x020a] FlashMeteringSegments = [1350 values]
[Pentax Makernote - 0x020b] SlaveFlashMeteringSegments = [1350 values]
[Pentax Makernote - 0x0215] CameraInfo = 78400 20180410 2 1 2040540
[Pentax Makernote - 0x0216] BatteryInfo = [20 values]
[Pentax Makernote - 0x021a] Unknown tag (0x021a) = [1146 values]
[Pentax Makernote - 0x021b] SaturationInfo = [382 values]
[Pentax Makernote - 0x021c] ColorMatrixA2 = [18 values]
[Pentax Makernote - 0x021d] ColorMatrixB2 = [18 values]
[Pentax Makernote - 0x021e] Unknown tag (0x021e) = 0 32 0 32 0 32 0 32
[Pentax Makernote - 0x021f] AFInfo = [2048 values]
[Pentax Makernote - 0x0221] KelvinWB = [138 values]
[Pentax Makernote - 0x0222] ColorInfo = [18 values]
[Pentax Makernote - 0x0224] EVStepInfo = [64 values]
[Pentax Makernote - 0x0226] ShotInfo = [76 values]
[Pentax Makernote - 0x0227] FacePos = [128 values]
[Pentax Makernote - 0x0228] FaceSize = [128 values]
[Pentax Makernote - 0x0229] SerialNumber = 7356770
[Pentax Makernote - 0x022a] FilterInfo = [345 values]
[Pentax Makernote - 0x022b] LevelInfo = [18 values]
[Pentax Makernote - 0x022c] Unknown tag (0x022c) = [46 values]
[Pentax Makernote - 0x022d] WBLevels = [109 values]
[Pentax Makernote - 0x0231] ContrastDetectAFArea = 404 216 48 48
[Pentax Makernote - 0x0234] Unknown tag (0x0234) = [161 values]
[Pentax Makernote - 0x0238] Unknown tag (0x0238) = 0 0 0 0 0 0 0 0 0 0 0
[Pentax Makernote - 0x023b] Unknown tag (0x023b) = [32 values]
[Pentax Makernote - 0x023c] Unknown tag (0x023c) = [1024 values]
[Pentax Makernote - 0x023d] Unknown tag (0x023d) = [20 values]
[Pentax Makernote - 0x023e] Unknown tag (0x023e) = 14 0 28 0 192 28 48 19
[Pentax Makernote - 0x0240] Unknown tag (0x0240) = [384 values]
[Pentax Makernote - 0x0241] Unknown tag (0x0241) = 247 222 0 0 247 222 0 0 15 104 0 0 163 102 0 0
[Pentax Makernote - 0x0242] Unknown tag (0x0242) = [1350 values]
[Pentax Makernote - 0x0243] PixelShiftInfo = [148 values]
[Pentax Makernote - 0x0244] Unknown tag (0x0244) = [52 values]
[Pentax Makernote - 0x0245] AFPointInfo = 1 0 33 0 0 0 0 0 64 0 0 0 0
[Pentax Makernote - 0x03ff] TempInfo = [768 values]
[Pentax Makernote - 0x0404] Unknown tag (0x0404) = [2086 values]
[Pentax Makernote - 0x0406] Unknown tag (0x0406) = [4116 values]

As you can see, many of the values are just displayed as numbers. We need to extend the descriptor to provide these descriptions, using the data available in https://exiftool.org/TagNames/Pentax.html

For inspiration, take a look at an existing descriptor class, such as CasioType1MakernoteDescriptor.