Author Topic: Extracting binary data from a custom tag  (Read 128 times)

v16p20

  • Jr. Member
  • **
  • Posts: 10
Extracting binary data from a custom tag
« on: January 14, 2021, 09:48:03 AM »
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?

Code: [Select]
exiftool -U -v3 affinity.tiff
returns

Code: [Select]
  | 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

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

Code: [Select]
exiftool -config affinity.config -affinity -v3 affinity.tiff
returns

Code: [Select]
  | 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)

Code: [Select]
exiftool -config affinity.config -b -affinity affinity.tiff > affinity.dat
creates a 305 bytes file

Thanks



Luuk2005

  • Full Member
  • ***
  • Posts: 63
Re: Extracting binary data from a custom tag
« Reply #1 on: January 14, 2021, 11:26:45 AM »
It seems that 110-bytes is only pretending for [ConvertedData] at end of lines, but binary-data is actually 305-bytes.
Win8.1-64bit, Exiftool12.11-standalone, Sed4.0.7

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17473
    • ExifTool Home Page
Re: Extracting binary data from a custom tag
« Reply #2 on: January 14, 2021, 11:30:15 AM »
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
« Last Edit: January 14, 2021, 01:38:50 PM by Phil Harvey »
...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 ($).

v16p20

  • Jr. Member
  • **
  • Posts: 10
Re: Extracting binary data from a custom tag
« Reply #3 on: January 14, 2021, 11:55:18 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).

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

Luuk2005

  • Full Member
  • ***
  • Posts: 63
Re: Extracting binary data from a custom tag
« Reply #4 on: January 14, 2021, 01:12:31 PM »
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' !
« Last Edit: January 14, 2021, 01:38:00 PM by Luuk2005 »
Win8.1-64bit, Exiftool12.11-standalone, Sed4.0.7

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17473
    • ExifTool Home Page
Re: Extracting binary data from a custom tag
« Reply #5 on: January 14, 2021, 01:37:59 PM »
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:

Code: [Select]
        Format => 'undef',
- 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 ($).

v16p20

  • Jr. Member
  • **
  • Posts: 10
Re: Extracting binary data from a custom tag
« Reply #6 on: January 16, 2021, 01:33:06 PM »
Ah, thank you very much. I could have thought of that myself. Works now as desired.