News:

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

Main Menu

Cannot write to XMP-iptcExt:ArtworkCircaDateCreated

Started by eleigh, June 02, 2020, 08:55:27 PM

Previous topic - Next topic

eleigh

It seems that the protection of ArtworkCircaDateCreated goes beyond what is described here:
https://exiftool.org/forum/index.php?topic=8861.msg45612#msg45612

It now prevents writing to the tag even when addressed precisely (this in Perl on Linux):

$exifTool->SetNewValue("XMP-iptcExt:ArtworkCircaDateCreated", "1810s", Replace => 1)

produces the error message (in v11.98, not not v10.00):

Sorry, XMP-iptcExt:ArtworkCircaDateCreated is unsafe for writing

Or am I missing something?

Phil Harvey

You must add Protected => 1 to the SetNewValue options to write this tag.

Jan. 12, 2018 - Version 10.75
  - Marked ArtworkCircaDateCreated as "unsafe" for writing to avoid it being
    added when attempting to shift all date/time tags


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

eleigh

Thanks Phil! And sorry to have bothered you with something I should have spotted in the documentation. However, I don't seem to be able to make that work. The instruction

3-N) [optional] SetNewValue option/value pairs (see below).

implies (to me) that the correct way is:

$exifTool->SetNewValue($tagName, $value, Replace => 1, Protected => 1)

But that's yielding the same error message.

I also tried:

$exifTool->SetNewValue($tagName, $value, {Replace => 1, Protected => 1})

and

$exifTool->SetNewValue($tagName, $value, (Replace => 1, Protected => 1))

I even tried including just that option:

$exifTool->SetNewValue($tagName, $value, Protected => 1)

But in every case I get the same error message.

Do I need to update to 11.99? (The CPAN repository I'm using only has 11.98.)

StarGeek

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Your first try was correct.

For example:

use Image::ExifTool qw(:Public);
my $et = new Image::ExifTool;

print "not protected:\n";
$et->SetNewValue('XMP-iptcExt:ArtworkCircaDateCreated', 'test');
print "protected:\n";
$et->SetNewValue('XMP-iptcExt:ArtworkCircaDateCreated', 'test', Protected => 1);
print "done\n";


And the output:

not protected:
Sorry, XMP-iptcExt:ArtworkCircaDateCreated is unsafe for writing
protected:
done


You shouldn't have to upgrade to see this behaviour.  It should be the same for any version of ExifTool that gives that warning message.

Note that you probably don't need the Replace option.  This is mainly only to replace existing new values for List-type tags which would otherwise accumulate multiple values.

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

eleigh

Thanks, Phil I've got it working now. It was my mistake (obviously!): I hadn't spotted I had two calls to SetNewValue(), only one of which had the 'Protected => 1' option set.

Incidentally, this didn't work:
$exifTool->Options(Protected => 1)

Might be worth tweaking the description in the documentation for the 'Protected' option:
Allow 'protected' and 'unsafe' tags to be written

Great software and great support, thank you!

Phil Harvey

Quote from: eleigh on June 04, 2020, 08:46:01 AM
Incidentally, this didn't work:
$exifTool->Options(Protected => 1)

Right.  This is a SetNewValue() option.

QuoteMight be worth tweaking the description in the documentation for the 'Protected' option:
Allow 'protected' and 'unsafe' tags to be written

Good suggestion.  Done.

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