trouble stripping dc:creator

Started by photon, April 09, 2011, 04:03:07 AM

Previous topic - Next topic

photon

Howdy folks,
I'm trying to strip XMP dc:creator and dc:CreatorTool from a bunch of images.  The problem is, I can't get it to actually strip the tags!  When I look at $tmp_fn the Creator & CreatorTool tags are still present. 

Here's my code.  Any idea what I'm doing wrong?   Thanks.

# $img_fn is the source image
# $tmpfn is a temporary (non-existent) file to store the creator tag-stripped version.
my $et = new Image::ExifTool;
$et->SetNewValue('Creator');
$et->SetNewValue('CreatorTool');
$et->WriteInfo($img_fn, $tmpfn)
    || confess("Error writing: " . $et->GetValue('Error'));
my $meta = $et->ImageInfo($tmpfn);
print $meta->{'Creator'} . "\n";  ## $tmpfn still has the tags present!


Phil Harvey

There are a number of reasons that this could happen, but most of them would be explained by warning messages:

$et->WriteInfo($img_fn, $tmpfn)
    || confess("Error writing: " . $et->GetValue('Error'));
my $wrn = $et->GetValue('Warning');
$wrn and warn "Warning: $wrn\n";


If this doesn't help, try setting the Verbose option before calling WriteInfo.  If neither of these gives you any joy, mail me the image in question (philharvey66 at gmail.com) and I should be able to figure out what is happening.

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

photon

Phil thanks so much for taking a look at this; and thanks so much for donating your time in creating such a library.  It has been enormously helpful to me.  I didn't get any warnings, and here are the relevant sections of the verbose output.  I'll go ahead and send you the image and full output.  This just happened to be the first image (of thousands) that I need to do this do; I didn't try the others.   Thanks again for checking this out.


Deleting PostScript:Creator
Deleting PDF:Creator
Deleting XMP-dc:Creator
Deleting XMP-pdf:Creator
Deleting XMP-xmp:CreatorTool
....
  Rewriting XMP
    [XMP rewritten with no changes]
.....
JPEG SOS
  ExifToolVersion = 8.50
  FileName = nY8olB_8Y5
  Directory = /var/folders/0Z/0ZBJXkRu2RWP4++1YrLdtU+++TI/-Tmp-
  FileSize = 657658
  FileModifyDate = 1302367801
  FilePermissions = 33188
  FileType = JPEG
  MIMEType = image/jpeg
....
  + [XMP directory, 3358 bytes]
  | XMPToolkit = Adobe XMP Core 5.0.0-ac003
  | GPSLatitude =
  | - Tag 'x:xmpmeta/rdf:RDF/rdf:Description/exif:GPSLatitude'
  | GPSLongitude =
  | - Tag 'x:xmpmeta/rdf:RDF/rdf:Description/exif:GPSLongitude'
  | [adding XMP-dc:CreatorTool]
  | CreatorTool = (( removed to protect the innocent ))
  | - Tag 'x:xmpmeta/rdf:RDF/rdf:Description/dc:CreatorTool'
  | Type = Photo
  | - Tag 'x:xmpmeta/rdf:RDF/rdf:Description/dc:type'
  | Title = 1974 Portland Mall design study
  | - Tag 'x:xmpmeta/rdf:RDF/rdf:Description/dc:title'
  | Creator = (( removed to protect the innocent ))
  | - Tag 'x:xmpmeta/rdf:RDF/rdf:Description/dc:creator'

Phil Harvey

Ah yes.  Improperly written XMP.

The problem is that as far as ExifTool is concerned, improperly written XMP just looks like new XMP tags which haven't been defined.  ExifTool will quite happily read them, but it can't be used to write them.

Your problem has the same source as the problem in this thread.

Badly written XMP can certainly cause confusion.  What software wrote this metadata?  These problems should be reported (I should really charge a consulting fee for this -- I have found many, many bugs in other software).  Here is a list of problems with this XMP:

1) dc:creator must be a Seq list

2) dc:CreatorTool does not exist.  Use xmp:CreatorTool

3) dc:keywords does not exist (there is a pdf:Keywords, but dc:subject should be used)

4) dc:description must be a lang-alt list

5) dc:type must be a Bag list

But you still need to deal with the mess left by the other software.  Luckily, you can use exiftool to rebuild the XMP using the command mentioned in the other thread:

exiftool -xmp:all= -tagsfromfile @ -xmp:all FILE

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

photon

This came out of an app called Bulkr - it's basically a tool for backing up images from Flickr (a friend of mine didn't bother to keep a local copy). 

I will report it to the author and write a little bit of perl to fix it.  Thanks for your help.

Phil Harvey

I have just released ExifTool 8.55.  In this version I have added a patch which checks specifically for incorrectly formatted XMP like this and fixes the problem when the tag is written (and issues a warning like "Fixed incorrect list type for dc:creator").

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

the_wanderer

Quote from: Phil Harvey on April 09, 2011, 05:20:03 PM

exiftool -xmp:all= -tagsfromfile @ -xmp:all FILE

- Phil

how do you wipe all existing data with perl api?  i don't want to use the command line.

this doesn't work.

$eT->SetNewValue();


thanks

Phil Harvey

Right.  I guess I should keep my examples appropriate to this forum section:

$eT->SetNewValue('all');  # queue all metadata for deletion

This is also explained in the documentation (well, OK, the documentation says to use '*' instead of 'all', but you didn't hear it from me that either will work).

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