Author Topic: reading and writing PhaseOne calibration tags  (Read 239 times)

Alex Matiash

  • Jr. Member
  • **
  • Posts: 22
reading and writing PhaseOne calibration tags
« on: April 07, 2019, 04:33:32 AM »
Hello. I need to read and write PhaseOne sensor calibration tags. Documentation says that they are not writable, but tags I need to write are not specified in documentation, so maybe?..
I need to R\W tags laying in TIFF-IFD0-ExifIFD-MakerNotes-SensorCalibration - Sensor Calibration 0x041f, 0x0420, etc.
First of all I need to read them fully, but I'm unable to find ExifTool argument to not to show them in shortened form like:
Quote
Sensor Calibration 0x0420       : 17 27 45 75 126 211 351 588 968 2016 4026 7987 14224 22[...]

How to ask ExifTool to show whole tag content?


And then I'll need to write them.
Is it possible, and if no - why?


Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14554
    • ExifTool Home Page
Re: reading and writing PhaseOne calibration tags
« Reply #1 on: April 07, 2019, 06:55:14 AM »
Add -n to see the whole content.

You can create user-defined tags to make them writable,  The config file will look something like this:

Code: [Select]
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::PhaseOne::SensorCalibration' => {
        0x041f => {
            Name => 'SensorCalibration_0x041f',
            Format => 'int32u',
            Writable => 1,
        },
        0x0420 => {
            Name => 'SensorCalibration_0x0420',
            Format => 'int32u',
            Writable => 1,
        },
    },
);
1; # end

If you know the meanings of some of these unnamed tags, please let me know.  Is writing these tags something that other people may want to do?

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

Alex Matiash

  • Jr. Member
  • **
  • Posts: 22
Re: reading and writing PhaseOne calibration tags
« Reply #2 on: April 08, 2019, 05:13:19 AM »
Quote
Add -n to see the whole content.
Thank you. Strange, but I was unable to find this switch.

Quote
You can create user-defined tags to make them writable,  The config file will look something like this:
Thank you again!

Quote
If you know the meanings of some of these unnamed tags, please let me know.  Is writing these tags something that other people may want to do?
Not sure that if I know, but it seems so. I don't think anyone may want to write to this tags as it is calibration of the sensor in current back. I own the digital back with bad calibration written in, and I want to play with this tables to see if I can fix it after shooting, until I will be able to send this back to the service for recalibration.

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 974
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
Re: reading and writing PhaseOne calibration tags
« Reply #3 on: April 08, 2019, 05:55:31 AM »
The -n option is listed as part of the Input-output text formatting options. Its description might have mislead you though; it simply says no print conversion and though that is exactly what it is, it may not have been clear that it would achieve what you were looking for.
Hayo Baan – Photography
Web: www.hayobaan.nl

Alex Matiash

  • Jr. Member
  • **
  • Posts: 22
Re: reading and writing PhaseOne calibration tags
« Reply #4 on: April 09, 2019, 06:19:01 AM »
I'm doing something wrong :(

here is my .ExifTool_config :

Code: [Select]
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::PhaseOne::SensorCalibration' => {
        0x041f => {
            Name => 'SensorCalibration_0x041f',
            Format => 'string',
            Writable => 1,
        },
        0x0420 => {
            Name => 'SensorCalibration_0x0420',
            Format => 'string',
            Writable => 1,
        },
0x0421 => {
            Name => 'SensorCalibration_0x0421',
            Format => 'string',
            Writable => 1,
        },
0x0422 => {
            Name => 'SensorCalibration_0x0422',
            Format => 'string',
            Writable => 1,
        },
0x0423 => {
            Name => 'SensorCalibration_0x0423',
            Format => 'string',
            Writable => 1,
        },
0x0424 => {
            Name => 'SensorCalibration_0x0424',
            Format => 'string',
            Writable => 1,
        },
0x0425 => {
            Name => 'SensorCalibration_0x0425',
            Format => 'string',
            Writable => 1,
        },
0x0426 => {
            Name => 'SensorCalibration_0x0426',
            Format => 'string',
            Writable => 1,
        },
0x0427 => {
            Name => 'SensorCalibration_0x0427',
            Format => 'string',
            Writable => 1,
        },
    },
);
1; # end

Command line I'm trying to execute:
exiftool "-SensorCalibration_0x041f<SensorCalibration_0x0426" -v CF000360.IIQ

And here is what I get:
Code: [Select]
======== CF000360.IIQ
Setting new values from CF000360.IIQ
Rewriting CF000360.IIQ...
  Editing tags in: ExifIFD IFD0 MakerNotes TIFF
  FileType = IIQ
  FileTypeExtension = IIQ
  MIMEType = image/x-raw
  Rewriting IFD0
  Rewriting ExifIFD
  Rewriting MakerNotePhaseOne
  Rewriting IFD1
  Copying 2 image data blocks
Nothing changed in CF000360.IIQ
    0 image files updated
    1 image files unchanged

I'm trying to copy SensorCalibration_0x0426 to SensorCalibration_0x041f, that's all.

P.S. If I declare tags format as int32u I'm getting following result:
Code: [Select]
======== CF000360.IIQ
Setting new values from CF000360.IIQ
Warning: Not an integer for PhaseOne:SensorCalibration_0x041f - CF000360.IIQ
Warning: No writable tags set from CF000360.IIQ
Nothing changed in CF000360.IIQ
    0 image files updated
    1 image files unchanged

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14554
    • ExifTool Home Page
Re: reading and writing PhaseOne calibration tags
« Reply #5 on: April 09, 2019, 08:02:58 AM »
Hi Alex,

You're right.  This is trickier than I thought.

First, you need to specify a Format of 'int32u' for these tags (as you mentioned).  But then you need to add "Count => -1," to each tag definition to allow multiple int32u values to be written.  And finally, the trickiest trick... You need to write a tag in the Main PhaseOne directory to trigger the editing.  I will fix this in the next version of ExifTool, but until then you can do it by rewriting the existing SerialNumber, like this:

exiftool "-SensorCalibration_0x041f<SensorCalibration_0x0426" -phaseone:serialnumber -v CF000360.IIQ

I tested this with a PhaseOne P40+ IIQ file and it works with the aforementioned config file changes.

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

Alex Matiash

  • Jr. Member
  • **
  • Posts: 22
Re: reading and writing PhaseOne calibration tags
« Reply #6 on: April 09, 2019, 09:00:00 AM »
Hi Phil, thank you very much, it works!