News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Extracting binary data from a custom tag

Started by v16p20, January 14, 2021, 09:48:03 AM

Previous topic - Next topic

v16p20

Hi,

when exporting a TIFF from Affinity Photo (version 1.8.5.703, Windows 10) Affinity creates a proprietary EXIF tag 0xc7e0 (length: 110 bytes, no idea what is in there). Using a configuration file I want to extract this data. But when I apply the configuration file, the size of the block grows to 305 bytes. Why? How can I extract the original data which is also shown with -htmldump?

exiftool -U -v3 affinity.tiff

returns

  | 13) Exif_0xc7e0 = 0 255 75 83 2 0 112 79 120 69 1 0 7 0 0 0 49 115 116 112 79 1 0 0[snip]
  |     - Tag 0xc7e0 (110 bytes, int8u[110]):
  |         00d0: 00 ff 4b 53 02 00 70 4f 78 45 01 00 07 00 00 00 [..KS..pOxE......]
  |         00e0: 31 73 74 70 4f 01 00 00 00 00 00 66 54 4f 45 01 [1stpO......fTOE.]
  |         00f0: 00 00 00 5f 52 4f 45 00 00 00 00 5f 5f 4f 45 00 [..._ROE....__OE.]
  |         0100: 00 00 02 31 50 43 43 49 00 29 50 49 6d 45 00 29 [...1PCCI.)PImE.)]
  |         0110: 74 4d 6d 45 00 31 74 74 61 4d 00 2a 70 6d 73 52 [tMmE.1ttaM.*pmsR]
  |         [snip 30 bytes]



affinity.config

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Exif::Main' => {
        0xc7e0 => {
            Name => 'Affinity',
            Writable => 'undef',
            WriteGroup => 'IFD0',
            Binary => 1,
        },
    },
);
1; # end


exiftool -config affinity.config -affinity -v3 affinity.tiff

returns

  | 13) Affinity = 0 255 75 83 2 0 112 79 120 69 1 0 7 0 0 0 49 115 116 112 79 1 0 0 0 [snip]
  |     - Tag 0xc7e0 (110 bytes, int8u[110]):
  |         00d0: 00 ff 4b 53 02 00 70 4f 78 45 01 00 07 00 00 00 [..KS..pOxE......]
  |         00e0: 31 73 74 70 4f 01 00 00 00 00 00 66 54 4f 45 01 [1stpO......fTOE.]
  |         00f0: 00 00 00 5f 52 4f 45 00 00 00 00 5f 5f 4f 45 00 [..._ROE....__OE.]
  |         0100: 00 00 02 31 50 43 43 49 00 29 50 49 6d 45 00 29 [...1PCCI.)PImE.)]
  |         0110: 74 4d 6d 45 00 31 74 74 61 4d 00 2a 70 6d 73 52 [tMmE.1ttaM.*pmsR]
  |         [snip 30 bytes]
Affinity                        : (Binary data 305 bytes, use -b option to extract)


exiftool -config affinity.config -b -affinity affinity.tiff > affinity.dat

creates a 305 bytes file

Thanks



Luuk2005

It seems that 110-bytes is only pretending for [ConvertedData] at end of lines, but binary-data is actually 305-bytes.
Windows8.1-64bit, exiftool-v12.11(standalone), sed-v4.0.7

Phil Harvey

#2
The 305 bytes is after ExifTool converts from int8u format to "0 255 75 83 2 0 112 79 120 69 1 0 7 0 0 0 49 ...".

You must override the int8u format with Format => 'undef', in your config file if you want the actual binary data.

- Phil

Edit: Added missing quotes
...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 ($).

v16p20

Quote from: Phil Harvey on January 14, 2021, 11:30:15 AM
You must override the int8u format with Format => undef, in your config file if you want the actual binary data.

I have changed the config, but the extracted data remains the same as before and is still converted (Win 10, ExifTool 12.14).

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Exif::Main' => {
        0xc7e0 => {
            Name => 'Affinity',
            Writable => 'undef',
            WriteGroup => 'IFD0',
            Binary => 1,
            Format => undef,
        },
    },
);
1; # end

Luuk2005

#4
For some reason, the only thing working for me is Format=>binary?? Why the -b not does this?<>
Edit: Its because Im using undef instead of 'undef' !
Windows8.1-64bit, exiftool-v12.11(standalone), sed-v4.0.7

Phil Harvey

Quote from: v16p20 on January 14, 2021, 11:55:18 AM
I have changed the config, but the extracted data remains the same as before and is still converted (Win 10, ExifTool 12.14).

Ooops.  My mistake.  You need quotes around undef:

        Format => 'undef',

- 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 ($).

v16p20

Ah, thank you very much. I could have thought of that myself. Works now as desired.