ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: eleigh on June 02, 2020, 08:55:27 PM

Title: Cannot write to XMP-iptcExt:ArtworkCircaDateCreated
Post by: eleigh on June 02, 2020, 08:55:27 PM
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?
Title: Re: Cannot write to XMP-iptcExt:ArtworkCircaDateCreated
Post by: Phil Harvey on June 02, 2020, 09:31:03 PM
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
Title: Re: Cannot write to XMP-iptcExt:ArtworkCircaDateCreated
Post by: eleigh on June 03, 2020, 06:45:13 PM
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.)
Title: Re: Cannot write to XMP-iptcExt:ArtworkCircaDateCreated
Post by: StarGeek on June 03, 2020, 06:55:57 PM
Try
$exifTool->Options(Protected => 1 );
Title: Re: Cannot write to XMP-iptcExt:ArtworkCircaDateCreated
Post by: Phil Harvey on June 03, 2020, 07:46:59 PM
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
Title: Re: Cannot write to XMP-iptcExt:ArtworkCircaDateCreated
Post by: eleigh on June 04, 2020, 08:46:01 AM
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!
Title: Re: Cannot write to XMP-iptcExt:ArtworkCircaDateCreated
Post by: Phil Harvey on June 04, 2020, 10:48:44 AM
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