ExifTool Forum

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

Title: Adding XMP
Post by: Archive on May 12, 2010, 08:54:02 AM
[Originally posted by ron on 2007-04-11 10:58:09-07]

Hello,

   I'd like to add XMP to TIFF, JPG, and EPS. Does ExifTool has an options to get the XMP save in different filename e.g. 0622.xmp?

I use this option when running (I'm using Windows executable),

exiftool.exe -v1 -tagsfromfile 0622.xmp F1.tif

but it prompt an error:

Setting new values from 0622.xmp

Error: File format error - 0622.xmp

First I think that there's something wrong with the XMP, but when I used Adobe PhotoShop to Append this XMP, it was added successfully. Can anyone help me or give me an idea what is the problem.

Thanks in advance.
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:02 AM
[Originally posted by exiftool on 2007-04-11 11:29:57-07]

Hi,

Could you send me a copy of the XMP so I can take a look at it?
My email is philharvey66 at gmail.com

It sounds like there is something different with the way this XMP
is formatted, and I may have to add support for this to exiftool.

Thanks.

- Phil
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:02 AM
[Originally posted by ron on 2007-04-11 12:44:40-07]

Hello Phil,

   Thanks for the reply, I just send you the XMP's. I'll be waiting for your reply. Thanks again.

regards.

ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:02 AM
[Originally posted by ron on 2007-04-11 12:46:21-07]

Hello Phil,

   Thanks for the reply, I just send you the XMP's. I'll be waiting for your reply. Thanks again.

regards.

ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:02 AM
[Originally posted by ron on 2007-04-11 13:00:22-07]

Hello Phil,

   Thanks for the reply, I just send you the XMP's. I'll be waiting for your reply. Thanks again.

regards.

ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:02 AM
[Originally posted by exiftool on 2007-04-11 13:32:06-07]

Thanks for the samples.

These files are odd.  They contain a UTF-8 byte order mark at the beginning
instead of in the "xpacket begin" attribute as per the XMP spec.  And the
"xpacket begin" contains an odd byte sequence that is not a UTF byte order
mark.  I will have to do a bit of research on this to see what is going on,
but I should have something for you to play with by the end of the day.

- Phil
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by ron on 2007-04-11 13:40:26-07]

Hello Phil,

   Thanks for the reply, I just send you the XMP's. I'll be waiting for your reply. Thanks again.

regards.

ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by exiftool on 2007-04-11 15:01:21-07]

Hi Ron,

I've figured out the reason for the weird characters in the "xpacket begin".  They are a
UTF-8 byte order mark which has been re-encoded in UTF-8.  Very odd.  So this XMP
file may have been double-encoded in UTF 8 encoding.  I'm not sure if this is legal or not,
but surely it is a stupid thing to do.  I would complain to the company that wrote the
software used to generate this XMP file.

But whether it is valid or not, I will add support for this type of file to ExifTool.  I have
prepared a
6.87
pre-release
for you to test out which will read/write the files you sent.  When
writing, ExifTool will format according to the XMP specification and fix this funny
double encoding.  However, it may be that special characters in the text are not converted
properly (since I am not double-decoding the UTF-8).  This needs testing.  Could you
send me a sample XMP file written by your application which contains special characters
(ie. characters with accents)?  I would like to see if the entire text is double-encoded,
or just the opening BOM.

Thanks.

- Phil
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by ron on 2007-04-12 03:30:42-07]

Hello Phil,

   Thanks for the reply, I just send you the XMP's. I'll be waiting for your reply. Thanks again.

regards.

ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by ron on 2007-04-12 08:29:20-07]

Hello Phil,

Sample XMP that I gave to you is produce by another program, I just talked to the developer and he said that it is just an opening BOM. BAck in adding XMP, using Image-ExifTool-6.87, XMP are now inserted but not all the data/tags in XMP files were capture. I noticed that all tags that has a namespace of <xap: > are not capture. Do I need to modify something or I'm just using a wrong Options in ExifTool? I'm a .NET developer and know nothing in PERL, hope you can still help me. Thanks.

-Ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by exiftool on 2007-04-12 12:17:37-07]

No.  It is not just an opening BOM.  The text is double UTF-8 encoded.
I have done more research, and this is clearly wrong.  Please send me
a sample with special characters so I can see how they are handled in
the body of the XMP.

As for not copying the xap information:  All of this information is non-standard
so ExifTool will not write it.  See
the
XMP xmp Tags
for a list of valid XMP-xmp (XMP-xap) tag names.

Here is a breakdown of the xap tags in your file:

Volume, Number, Publication, PubDate, Section, Usagerights, PageNo,
DOI
- these tag names do not exist in the XMP standard.

Subject - this is an XMP-dc tag.

Credit - this is an XMP-photoshop tag.

So I suggest you talk some more with your software developer.

- Phil
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by exiftool on 2007-04-12 12:43:50-07]

For the benefit of others, I should mention that you can write the
entire XMP record as a block to the file.  This way you get an exact
copy of the XMP information, including any non-standard tags:

Code:
exiftool "-xmp<=XMPFILE" IMAGEFILE

However, this won't work for your specific XMP file
because ExifTool checks the validity of the XMP format before
writing, and this check would fail because of the incorrect leading
BOM and double-encoding problem.

- Phil
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by ron on 2007-04-14 12:09:10-07]

Hello Phil,

Using the options you gave, of course it will not work for me because of the reason you've mentioned but after I run the StripBOM which our developer gave to me (I don't know if they developed it or just download), inserting XMP work. But there's a problem, for me to know if the XMP is really inserted I used PhotoShop to check it, File > File Info.., no Document Title and the authors are not capture all, but when using PhotoShop to insert that same XMP, Document Title and authors were displayed correctly. These happen to TIFF images but in JPEG everything display in PhotoShop. Can you tell me the reason why. Thanks in advance.

-Ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by ron on 2007-04-14 12:16:31-07]

Hello Phil,

Using the options you gave, of course it will not work for me because of the reason you've mentioned but after I run the StripBOM which our developer gave to me (I don't know if they developed it or just download), inserting XMP work. But there's a problem, for me to know if the XMP is really inserted I used PhotoShop to check it, File > File Info.., no Document Title and the authors are not capture all, but when using PhotoShop to insert that same XMP, Document Title and authors were displayed correctly. These happen to TIFF images but in JPEG everything display in PhotoShop. Can you tell me the reason why. Thanks in advance.

-Ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by exiftool on 2007-04-14 13:12:25-07]

Hi Ron,

I would like to see the XMP you are inserting.  Just stripping the BOM
isn't enough to properly format the XMP, since there is a 2nd BOM in
the "xpacket begin" which has been re-encoded in UTF-8, and this
encoding needs to be reversed.  This could confuse other applications
if not done properly, and Photoshop is easy to confuse.

But maybe this isn't your problem because you say that this works
in JPEG images with Photoshop.

This works for me when I try it with Photoshop 7, so there is
something about your XMP, your TIFF file, or your Photoshop version
which is different.  Send me your XMP and your TIFF file and I will
try it with my Photoshop version.

- Phil
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by ron on 2007-04-17 11:33:27-07]

Hello Phil,

I'm sending you the XMP that I was inserting. After I run the StripBOM, double encoding is still there, but running the option that you gave, exiftool can now read the XMP format and it was successfully inserted.

Viewing of XMP data now works with Adobe Bridge, before I'm using PhotoShop CS and it cannot view those data and I don't know why.

Thanks for your help Phil.

btw, using option -w, does it works if there is an error in inserting XMP? I notice that -w only write console output if it is successfully inserted, is there a way that error prompted in console be included in -w?

-Ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by ron on 2007-04-17 11:36:45-07]

Hello Phil,

I'm sending you the XMP that I was inserting. After I run the StripBOM, double encoding is still there, but running the option that you gave, exiftool can now read the XMP format and it was successfully inserted.

Viewing of XMP data now works with Adobe Bridge, before I'm using PhotoShop CS and it cannot view those data and I don't know why.

Thanks for your help Phil.

btw, using option -w, does it works if there is an error in inserting XMP? I notice that -w only write console output if it is successfully inserted, is there a way that error prompted in console be included in -w?

-Ron
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:03 AM
[Originally posted by exiftool on 2007-04-17 12:24:52-07]

Hi Ron,

Thanks for the sample.  Yes, this XMP is still double-UTF8 encoded.  This
means that the "xpacket begin" attribute contains an invalid BOM marker
(which is probably the reason that PS CS had a problem with it), and likely
means that any special characters in the text will be corrupted.

Rather than use your SripBOM utility, you can use the new version of exiftool
(6.87) to fix this properly.  You can download a 6.87 pre-release
here.

You can rewrite the file with a command like this:

Code:
exiftool original.xmp -o fixed.xmp

You will get a warning message that the XMP is double UTF-encoded, and
exiftool 6.87 will double-decode it.  I still haven't received a sample containing
any special characters, but I have assumed that they will be double-encoded
like the BOM, so this should fix them too.

About your -w question:  The -w output is redirected from STDOUT, and
should not contain error or warning messages since they are sent to STDERR.

- Phil
Title: Re: Adding XMP
Post by: Archive on May 12, 2010, 08:54:04 AM
[Originally posted by ron on 2007-04-25 01:31:28-07]

Hello Phil,

I've tested your new version(6.87) several times in different format (tif, jpg, and eps) and its working fine. Thanks for your continuous support.

-Ron