ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:53:53 AM

Title: Problem writing tags - IPTC related (I think)
Post by: Archive on May 12, 2010, 08:53:53 AM
[Originally posted by billd on 2006-02-21 05:38:08-08]

I'm having a problem adding metadata to a file. Here is what I did:

JPG from Canon S80. Tagged some info in Adobe Bridge or Pixvue (same thing happens using either application). Tried to change using ExifTool.
 

ExifTool reported no errors. However, when viewing metadata in Pixvue, no IPTC related info is shown and when opening in Photoshop CS2, PS reports an error with the meta data that can be ignored. One point is that in PS after ignoring the error, the file name is prepended by a copyright symbol.

Below is the ExifTool command:

perl exiftool  -IPTC:City="Vancouver" -IPTC:Province-State="British Columbia" -IPTC:Country-PrimaryLocationName="Canada" -XMP:City="Vancouver" -XMP:State="British Columbia" -XMP:Country="Canada" "C:\temp\a.jpg"
Title: Re: Problem writing tags - IPTC related (I think)
Post by: Archive on May 12, 2010, 08:53:53 AM
[Originally posted by exiftool on 2006-02-21 13:37:03-08]

I've taken a PowerShot S80 sample and used the exact command line that you gave, and PS7 has no problem with the image.  But CS2 is a bit pickier. Unfortunately my trial copy of CS2 expired so I can't test this myself (and I don't have Pixvue), so you'll have to help me out here.  (You should know that CS2 will complain if it sees anything it doesn't recognize, even if the meta information is perfectly fine. I have never seen the copyright symbol in the filename though.)  Here are some things to try:

1) See if you can narrow it down to exactly which tag CS2 is complaining about.

2) Can Pixvue write meta information?  If so, try writing in Pixvue and using ExifTool to see exactly what it wrote.  Otherwise, take a file that Pixvue doesn't have a problem with and use ExifTool to see what information is in this file.  Then use ExifTool to write exactly this information and see if Pixvue still has problems.  If so, send me both files and I may be able to figure out what the difference is.

It will take a bit longer to sort this out since I can't run the software you are using, but if you stick with it we will be able to determine what is going on.
Title: Re: Problem writing tags - IPTC related (I think)
Post by: Archive on May 12, 2010, 08:53:53 AM
[Originally posted by billd on 2006-02-22 03:27:50-08]

I've done some more investigating. I was wrong about bridge->exiftool errors. It is only pixvue->exiftool that causes errors. There are no exiftool->ps or pixvue->ps errors.

Pixvue is a free windows shell extension that lets you view exif, iptc, and xmp metadata from windows explorer by right clicking and chosing properties. It also is a iptc and xmp editor and it does some galleries and organization as well. It is a very handy utility. See www.pixvue.com. Like exiftool, it does not write all the extra xmp data that the Adobe apps do.

When tagging initially with PixVue, all the iptc and xmp tags seem to be correctly written and when reviewing with exiftool using -G1 -s, iptc tags show as part of [IPTC]. After writing additional iptc and xmp with exiftool, exiftool reports the iptc tags as [IPTC2]. I'm 90% sure this is the cause of the PS error and it also causes PixVue to only report xmp tags as being present.

I will send the corrupted file to you.

One other question...is it possible to add the copywright symbol as part of a windows batch file? I have not been able to do so.

Thanks very much. Your program is very good, except I am not very fast at command line typing.
Title: Re: Problem writing tags - IPTC related (I think)
Post by: Archive on May 12, 2010, 08:53:53 AM
[Originally posted by exiftool on 2006-02-22 16:16:07-08]

Thanks for the samples.  The problem was that PixVue is writing the JPEG segment which contains the IPTC information (APP13) AFTER the DQT segment.  This is odd.  Normally all APP segments come before the image itself.  ExifTool makes an assumption that that the APP segments come first to avoid having to buffer the image data while editing the meta information.  This is true with every other JPEG image I have seen.  You should suggest to the PixVue developers that they write APP13 before DQT.

But in any event I need to accomodate this in ExifTool.

What was happening is that ExifTool reached the image data and assumed that APP13 didn't exist so it created a new one.  And when the existing APP13 was found after the DQT it was written as well.  You were seeing problems with the other applications because they didn't like to see two APP13 segments (as you guessed by the duplicate IPTC2 record).

So I have made two changes:

1. ExifTool will now issue a [minor] error if a duplicate segment is created.

2. ExifTool now peeks ahead past the DQT to see if there are additional APP segments hiding back there. This should fix the problem when rewriting PixVue-edited images as they exist now.  To repair any files you have already edited, you will have to erase all IPTC information then add it back in again with a new version of ExifTool.

I have added these changes to version 6.02 which will be released officially within a few days.  If you want to test out a pre-release version before the official release, you can download the 6.02 pre-release
here.

Thanks for pointing out this problem, and for following up with more information.

About your copyright question.  I'm not a Windows expert so I don't know how to create a Windows batch file, but this can be done easily in Perl (provided you know the character code for the copyright symbol).  To which tag did you want to add the symbol?
Title: Re: Problem writing tags - IPTC related (I think)
Post by: Archive on May 12, 2010, 08:53:53 AM
[Originally posted by billd on 2006-02-24 03:12:42-08]

Thanks for your help. I want to write the copyright to XMP:Rights.
Title: Re: Problem writing tags - IPTC related (I think)
Post by: Archive on May 12, 2010, 08:53:53 AM
[Originally posted by exiftool on 2006-02-24 14:46:49-08]

The following Perl script will add a symbol followed by a space to the start of XMP:Rights if it exists and doesn't already begin with the symbol.  The command line for the script looks like this:

Code:
   perl script_name file_name C

where "script_name" is the name of the script, "file_name" is the name of the image you want to modify, and "C" is your copyright symbol.

Here is the script:

Code:
#!/usr/bin/perl -w
use strict;
BEGIN { push @INC, "lib" }
use Image::ExifTool;
my $file = shift;
my $symbol = shift || die "Must specify file name and symbol to add to XMP:Rights\n";
my $exifTool = new Image::ExifTool;
$exifTool->ImageInfo($file,"Rights",{Group => 'XMP'});
my $rights = $exifTool->GetValue("Rights");
if (defined $rights) {
    $rights =~ /^$symbol/ or $rights = "$symbol $rights";
    $exifTool->SetNewValue("XMP:Rights" => $rights);
    $exifTool->WriteInfo($file) or die "Error updating $file\n";
    print "Updated $file\n";
} else {
    print "No XMP:Rights in $file\n";
}
# end