Hello,
I have a tiff image which tag is not standardised. More specifically, I want to copy this tag to another tiff image. I get the following error :
Warning: Tag 'Unknown_0x0023' is not defined
My code is as follow (I just here try to set it to a random value):
ExifTool *et = new ExifTool();
et->SetNewValue("Unknown_0x0023","41");
et->WriteInfo(argv[2],"-overwrite_original\n-f");
int result = et->Complete();
if (result <= 0) cerr << "Error executing exiftool!" << endl;
I've tried the option -f (force) but it doesn't work. Any idea what I should do ?
Thanks
You need to create a user-defined tag definition (https://exiftool.org/config.html) to be able to write an unknown tag.
- Phil
Ok, thanks, but I am not sure of how to adapt this to C++. Any hint on how to use this with the c++ interface ?
This should work as long as the config file is named .Exiftool_config and located in your home directory or the same directory as exiftool (as mentioned in the sample config file I linked).
- Phil
Great, it now works !
Follow up question :
I now have 2 tags named "Unknown_0x0023", with different values. How is it possible to have twice the same name ? Is it because these tags are not stored at the same location in memory ? The output looks like this :
Unknown 0x0023 : 63
Unknown 0x0023 : 41
I modified your config file to define my specific tag as follow :
# Example 1. EXIF:NewEXIFTag
0x0023 => {
Name => 'Unknown_0x0023',
Writable => 'int16u',
WriteGroup => 'IFD0',
},
Not sure what these numbers mean : 0xd000, 0xd001, etc..
The numbers are the tag ID stored in the file.
Are they stored in the same location? (ie. add the -G1 option when extracting)
If so, then we have a problem.
- Phil
The two tags are stored in different groups, which means I guess the file is consistent :
[IFD0] Unknown 0x0023 : 41
[MakerUnknown] Unknown 0x0023 : 63
But then, how can I force my code to write over the tag "Unknown 0x0023 " in the group "MakerUnknown" ?
Adding the ability to write unknown maker notes would be very complicated. Basically nothing but ExifTool will read this metadata anyway. Are you sure you need to do this?
- Phil