Adding additional unknown tags to existing images

Started by Archive, May 12, 2010, 08:53:56 AM

Previous topic - Next topic

Archive

[Originally posted by panday on 2006-10-04 11:32:23-07]

Hello Phil! I'm running in Windows XP via Active Perl 5.8.8. Does this answer your question?

- Panday

Archive

[Originally posted by exiftool on 2006-10-04 13:49:43-07]

Hi Panday,

Not really.  But given that information it is likely that you are using the Windows cmd shell.

The environment variables (unfortunately) depend on the specific command shell that you are using, and are not related to the version of Perl or (technically) the system you are running.  But the 'cmd' shell is (I believe) the only shell that ships with a standard Windows installation.

- Phil

Archive

[Originally posted by panday on 2006-10-04 15:39:32-07]

Sorry about that . . .

Yup! I did use the MS Windows CMD shell

- Henry Santyana

Archive

[Originally posted by panday on 2006-10-04 15:40:09-07]

Sorry about that . . .

Yup! I did use the MS Windows CMD shell

- Henry Santyana

Archive

[Originally posted by binouch on 2006-11-09 16:25:57-08]

Hello,

I just discovered this new module and the concept of what it could do is fantastic. I'm trying to put it into "production" in my environment but i'm running into some difficulties. I would like to add custom tags to files. Here is what i've done so far but infortunately i get the "Tag 'CustomerName' does not exist" error.
I built a .ExifTool_config file that i put in both the EXIFTOOL_HOME directory and the dir in which i am running the script from (just to make sure - this is running on linux).
Here is the content of the .ExifTool_config file :
Code:
%Image::ExifTool::UserDefined::myCompany = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-xxx', 2 => 'Image' },
    NAMESPACE => { 'myCompany' => 'http://ns.myname.com/xxx/1.0/' },
    WRITABLE => 'string',
    # replace "NewXMPxxxTag1" with your own tag name (ie. "MyTag")
    CustomerName => { },
    NewXMPxxxTag2 => { Groups => { 2 => 'Author' } },
    NewXMPxxxTag3 => { List => 'Bag' },
);

# The %Image::ExifTool::UserDefined hash defines new tags to be
# added to existing tables.
%Image::ExifTool::UserDefined = (

    # new XMP namespaces (ie. XMP-xxx) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        myCompany => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::myCompany',
            },
        },
    },
);
And the script i'm running to write a new value to that tag on a file is the following :

Code:
#!/usr/bin/perl

        use Image::ExifTool;
        my $exifTool = new Image::ExifTool;
        $exifTool->SetNewValue(CustomerName => "Bla Inc");
        $exifTool->WriteInfo('/raid1/Jobs/newCompany/Jacobs_018.tif');

Any kind of help would be appreciated - I'd really like to get this module working.

Thank you in advance.

Ben

Archive

[Originally posted by binouch on 2006-11-09 16:29:08-08]

Hello,

I just discovered this new module and the concept of what it could do is fantastic. I'm trying to put it into "production" in my environment but i'm running into some difficulties. I would like to add custom tags to files. Here is what i've done so far but infortunately i get the "Tag 'CustomerName' does not exist" error.
I built a .ExifTool_config file that i put in both the EXIFTOOL_HOME directory and the dir in which i am running the script from (just to make sure - this is running on linux).
Here is the content of the .ExifTool_config file :
Code:
%Image::ExifTool::UserDefined::myCompany = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-xxx', 2 => 'Image' },
    NAMESPACE => { 'myCompany' => 'http://ns.myname.com/xxx/1.0/' },
    WRITABLE => 'string',
    # replace "NewXMPxxxTag1" with your own tag name (ie. "MyTag")
    CustomerName => { },
    NewXMPxxxTag2 => { Groups => { 2 => 'Author' } },
    NewXMPxxxTag3 => { List => 'Bag' },
);

# The %Image::ExifTool::UserDefined hash defines new tags to be
# added to existing tables.
%Image::ExifTool::UserDefined = (

    # new XMP namespaces (ie. XMP-xxx) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        myCompany => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::myCompany',
            },
        },
    },
);
And the script i'm running to write a new value to that tag on a file is the following :

Code:
#!/usr/bin/perl

        use Image::ExifTool;
        my $exifTool = new Image::ExifTool;
        $exifTool->SetNewValue(CustomerName => "Bla Inc");
        $exifTool->WriteInfo('/raid1/Jobs/newCompany/Jacobs_018.tif');

Any kind of help would be appreciated - I'd really like to get this module working.

Thank you in advance.

Ben

Archive

[Originally posted by exiftool on 2006-11-09 17:33:04-08]

I should add this to the FAQ because it seems to be a common
problem.  What you have done in the config file will work
(I tested it), provided that ExifTool can find the config file.

To debug this, try putting the following line in your config file:

Code:
print "found it!\n";

You should then get a print-out if the config file is loaded.
If you don't, check your environment variables and/or try
moving the config file to the same location as your script.
On Unix systems, this generally isn't a problem, but apparently
Windows systems are not so consistent, and what works on
my XP system may not work on yours.

Please let me know what you find.

- Phil

Archive

[Originally posted by binouch on 2006-11-09 21:04:53-08]

I don't really know why it wasn't seeing the EXIFTOOL_HOME env but it does now and printing the "find it" at the end is a good debugging "trick".
It doesn't error out saying "couldn't find tag_name", but when i print out the ImageInfo that tag doesn't show. Would you have any idea why? Does it need to have a valid namespace and if yes would you have an example of how that should look?

Thank you very much for your help.

Ben

Archive

[Originally posted by binouch on 2006-11-09 21:15:09-08]

I don't really know why it wasn't seeing the EXIFTOOL_HOME env but it does now and printing the "find it" at the end is a good debugging "trick".
It doesn't error out saying "couldn't find tag_name", but when i print out the ImageInfo that tag doesn't show. Would you have any idea why? Does it need to have a valid namespace and if yes would you have an example of how that should look?

Thank you very much for your help.

Ben

Archive

[Originally posted by binouch on 2006-11-09 21:59:30-08]

I don't really know why it wasn't seeing the EXIFTOOL_HOME env but it does now and printing the "find it" at the end is a good debugging "trick".
It doesn't error out saying "couldn't find tag_name", but when i print out the ImageInfo that tag doesn't show. Would you have any idea why? Does it need to have a valid namespace and if yes would you have an example of how that should look?

Thank you very much for your help.

Ben

Archive

[Originally posted by exiftool on 2006-11-09 23:26:10-08]

I'm not sure what your problem is.  Here is a terminal session
(tcsh Unix terminal) with your .ExifTool_config installed:

Code:
% cp t/images/Writer.jpg a.jpg

% ./exiftool a.jpg -customername=test
found it!
    1 image files updated

% ./exiftool a.jpg -a -u -G1
found it!
[ExifTool]      ExifTool Version Number         : 6.56
[File]          File Name                       : a.jpg
[File]          File Size                       : 3 kB
[File]          File Modification Date/Time     : 2006:11:09 18:18:09
[File]          File Type                       : JPEG
[File]          MIME Type                       : image/jpeg
[File]          Image Width                     : 8
[File]          Image Height                    : 8
[XMP-myCompany] Customer Name                   : test
[Composite]     Image Size                      : 8x8

% ./exiftool a.jpg -xmp -b
found it!
<?xpacket begin='.......' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 6.56'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

 <rdf:Description rdf:about=''
  xmlns:myCompany='http://ns.myname.com/xxx/1.0/'>
  <myCompany:CustomerName>test</myCompany:CustomerName>
 </rdf:Description>
</rdf:RDF>
</x:xmpmeta>

So this doesn't work for you? (with commands translated as
appropriate for your terminal type.)  Try a test using the same
image (t/images/Writer.jpg) and paste your terminal session so
I can see the output.

- Phil

Archive

[Originally posted by exiftool on 2006-11-09 23:39:00-08]

Oh.  I should mention that if you paste the output to this forum,
you must wrap it in <code> ... <code> to protect the
formatting and special characters.  Also, I had to delete the
non-ASCII characters in the quotes after "xpacket begin="
because they were generating a format error when I tried to post.

Archive

[Originally posted by exiftool on 2006-11-09 23:40:28-08]

sorry, that's
Code:
...


(wish this forum had an edit feature...)

Archive

[Originally posted by binouch on 2006-11-12 21:42:14-08]

Hi Phil,

Thank you very much for your help - here is the error i get but i think at this point it's not related to your module but i need to do my home work about XMP namespaces.

Code:
[root@dev newCompany]# exiftool Jacobs_018.tif -CompanyName='newCompany'
found it!
No URI for namepace prefix HASH(0x8f32234)!
Warning: Undefined XMP namespace: HASH(0x8f32234) - Jacobs_018.tif
Error: Internal error writing IFD0:ApplicationNotes - Jacobs_018.tif
    0 image files updated
    1 files weren't updated due to errors

On a different note you say on the product home page under "Known Problems" that "Some applications on Macintosh systems may store information in the resource fork of a file. ExifTool does not process the resource fork, so this information is lost if the file is rewritten." What can be the consequence of that - in the environment in which i would like to deploy this all my users access their images using a mac - does that mean that the information written with ExifTool could get erassed ?

Thank you very much for your help.

Ben

Archive

[Originally posted by exiftool on 2006-11-13 01:25:45-08]

Sorry, that is an ExifTool problem.  I used a technique to define the XMP
namespace (with curly braces instead of square brackets) that I added
recently.  Either update to the latest ExifTool or change to square brackets
on the "NAMESPACE" line.  This should fix the problem.

I'm on a Mac here, btw.  The Mac resource fork is typically used to store
preference settings and state information, and usually not much more
(at least with the file formats that ExifTool will edit).  Any files exchanged
from a Mac to a PC automatically lose the resource fork anyway.  So there
is usually no crutial information stored in the resource fork.

- Phil