ExifTool Forum

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

Title: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by rshbkr on 2006-09-06 21:53:14-07]

Hi,
 I need to add additional tags to existing tiff images, with specific values associated with each image. Did not use ExifToll till now. Want to use ExifToll as a module instead of the command line option.
 how can i add the tags and values to existing tiff images.(The TAG #'s are in the range of 45000 to 45016)

Thanks
Raja
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by exiftool on 2006-09-07 00:05:10-07]

Hi Raja, I've got some reading for you:

First, you should look through the API documentation by typing "perldoc Image::ExifTool" or browsing
html/ExifTool.html.  This gives you details about how to call the functions in the module.  This part
should be relatively straightforward once you have a feel for the API.  Basically, all you need to do is
something like this:

Code:
my $exifTool = new Image::ExifTool;
$exifTool->SetNewValue('MyNewTag' => $value);
$exifTool->WriteInfo($file);

Then you should look at "ExifTool_config" for example of how to add user-defined tags.  There isn't an
example for adding an EXIF tag, but you can do it with an entry like this to your "~/.ExifTool_config"
file:

Code:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Exif::Main' => {
        45000 => {
            Name => 'MyNewTag',
            Writable => 'int16u',
            WriteGroup => 'IFD0',
        },
    },
);

The tag is written to the ExifIFD by default unless you specify another WriteGroup as IFD0 above.  The Writable attribute
must be set according to the format for the value.  You can also add value conversions (ValueConv, ValueConvInv) and
print conversions (PrintConv, PrintConvInv) if necessary.

Finally, you can read lib/Image/ExifTool/README for details about these attributes if necessary.  Also see Exif.pm and
WriteExif.pl for examples of attributes used for other tags.
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by rshbkr on 2006-09-07 17:55:25-07]

Thanks for the help.
I was able to add new userdefined tags and it worked.
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by panday on 2006-10-02 18:49:14-07]

Hi!

Newbee here.

I've recently tried exploring ExiifTool to embed XMP information in my images (Note: It's also only recently that I started learning Perl).

Anyway, I've tried the following code:

Code:
   #!/usr/bin/perl</i>

    use Image::ExifTool;

       $exifTool->SetNewValue('tag1','data1');
       $exifTool->WriteInfo('test.tif');

However, I keep on getting this error message --
Can't call method "SetNewValue" on an undefined value at test.pl line 5.

Any idea on where I went wrong??

Any replies will be greatly appreciated and thank you in advance.

- Panday
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by exiftool on 2006-10-02 19:17:25-07]

Hi Panday,

You've forgotten the following line from my example:

Code:
my $exifTool = new Image::ExifTool;

You need to create an ExifTool object to use for accessing the writer functions.

Also, for your code to work, 'tag1' will need to be a valid tag name.

- Phil
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by panday on 2006-10-02 21:25:25-07]

Thanks Phil! I think that resolve my earlier problem. However, you mentioned that my code would only work for a valid tag. I've tried making some edits to the ExifTool_config file as well as the XMP.pm file however I'm still getting an error message:

Code:
Tag 'tag1' does not exist
I want to add custom tailored metadata information such as <xap:volume>, <xap:issue> and <xap:publication>. I hope I'm not asking to much questions and again thank you in advance.

- Panday
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by panday on 2006-10-02 21:45:00-07]

Here's some of the lines I added to the ExifTool_config

Code:
%Image::ExifTool::UserDefined::xap = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-xap', 2 => 'Image' },
    NAMESPACE => [ 'xap' => 'http://ns.myname.com/xap/1.0/' ],
    WRITABLE => 'string',
    volume => { },
);

and

Code:
'Image::ExifTool::XMP::Main' => {
        xap => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::xap',
            },
        },
    },
    'Image::ExifTool::XMP::xap' => {
        volume => { } },
    },
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by exiftool on 2006-10-02 22:42:00-07]

There are a few problems with this:

1) I think you probably have too many right braces on the line with "volume => {}},".

2) Your "xap" namespace conflicts with an existing namespace.  "xap" is the old name used for the
"xmp" namespace.  So you will have to choose another namespace prefix.

3) The table "Image::ExifTool::XMP::xap" doesn't exist. So your last definition will result in an
error.

4) You have attempted to define the "volume" tag twice.  Deleting all of the following code will
solve problems 1, 3 and 4:

Code:
'Image::ExifTool::XMP::xap' => {
        volume => { } },
    },

But in the process, you've highlighted a problem in ExifTool:  I should be printing warning messages
if there are syntax errors in the config file.  This will be fixed in the next version, and I have uploaded
a pre-release here
since it may be useful to you.

- Phil
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by panday on 2006-10-03 01:18:14-07]

Again Phil thank you for being patient with me.

I'm also glad that I was able to help report a minor bug

It was my intention to use "xap" - the old name space of "xmp". If I could simplify my earlier question, what if I want to add a new tag in the current "xap" namespace?

Just to further illustrate what I have in mind, here's an example of the XMP I need to embed inside the image

Code:
 <rdf:Description>
       <xap:Volume>8</xap:Volume>
       <xap:Number>2</xap:Number>
       <xap:Publication>Liwayway</xap:Publication>
       <xap:PubDate>
            <rdf:Alt>
                  <rdf:li>09/12/2006</rdf:li>
            </rdf:Alt>
       </xap:PubDate>
       <xap:Subject>
            <rdf:Bag>
                  <rdf:li>Horror</rdf:li>
            </rdf:Bag>
       </xap:Subject>
 </rdf:Description>
Again, thank you.

- Henry Santyana
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by exiftool on 2006-10-03 02:02:46-07]

Adding to an existing namespace is easier. The only trick here is that you have
to use the newer 'xmp' namespace, not the older 'xap'.  (Although ExifTool will honour
the older namespaces if they already exist in the information.)

So all you needed was the part I told you to delete before (in the
%Image::ExifTool::UserDefined hash), just like the 'NewXMPxmpTag' example:

Code:
   'Image::ExifTool::XMP::xmp' => {
        Volume => { },
    },

(Note the capitalized 'Volume', if that is how you want it recorded in the XMP.)

- Phil
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by panday on 2006-10-03 04:00:56-07]

Hello Phil!

I'm still getting an error.

Code:
Tag 'Volume' does not exist
What I did was add

Code:
Volume => { },
where the

Code:
NewXMPxmpTag => { Groups => { 2 => 'Author' } },
used to be placed.

As for my code:

Code:
#!/usr/bin/perl

use Image::ExifTool;

  my $exifTool = new Image::ExifTool;
  $exifTool->SetNewValue('Volume','01');
  $exifTool->WriteInfo('test.tif');
Am I still missing anything?

- Henry Santyana
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by exiftool on 2006-10-03 13:08:30-07]

Hi Henry,

You're not missing anything.  That will work.  Did you download the 6.45 pre-release?  Perhaps there is a syntax error somewhere else in your config file.  I suggest taking a new copy of the original config file and changing just 'NewXMPxmpTag' to 'Volume'.

Oh.  And did you remember to copy the config file to ".ExifTool_config" in your home directory?  (note the "." at the start of the file name.)  ExifTool looks in your home directory for the config file.

- Phil
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by panday on 2006-10-03 14:34:01-07]

Hello Phil!

I was able to finally make it work. However, it seems the config file needs to be placed where my script is placed and not in the home directory

Anyway, thank you very much for all the help.

- Henry Santyana
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by exiftool on 2006-10-03 17:05:24-07]

Hi Henry,

I'm glad you figured it out.

This would happen if your HOME environment variable is not set.  What shell are you using?
All Unix shells I know set this, but I don't know about the Windows cmd shell.

The logic is as follows:

If the EXIFTOOL_HOME environment variable is set, ExifTool looks there for the config file.
Otherwise, it looks in your HOME directory.  If neither EXIFTOOL_HOME or HOME are set,
then  ExifTool defaults to using the current directory.

- Phil
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[Originally posted by exiftool on 2006-10-03 23:09:49-07]

I just tested this on a Windows machine, and HOME is not set in the
cmd shell environment.  However, HOMEDRIVE and HOMEPATH are,
so I will add the ability to use these if neither EXIFTOOL_HOME nor
HOME is available.  This feature will appear in 6.45 when it is released.

- Phil
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:56 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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.
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[Originally posted by exiftool on 2006-11-09 23:40:28-08]

sorry, that's
Code:
...


(wish this forum had an edit feature...)
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[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
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[Originally posted by binouch on 2006-11-13 14:04:56-08]

I installed the latest version of ExifTool and it works great now Smiley Thank you Phil. If i may ask you another question : when i write a new tag or a new value to a file in the following way:
Code:
exiftool Jacobs_018.tif -CompanyName=BlaInc
it takes a few seconds depending on the size of the file. I tried it on a 600MB file and it takes well over a minute.
Code:
[root@dev MODELS]# time exiftool large_file.tif -CompanyName=BlaInc
found it!
    1 image files updated

real    1m29.322s
user    0m7.330s
sys     0m18.940s
so the qestion is : can i run exiftool in a way that's more optimized? (reading the XMP info is very fast).
Thank you for your help, your answers so far and this module in general which is very valuable for what i'm trying to do.

Ben
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[Originally posted by exiftool on 2006-11-13 15:21:30-08]

Wow, 600MB.  That's a big file.  I've made a number of optimizations
to improve performance for large files, and I don't think you will find
anything that is much faster.  I'm sure you are I/O limited here...
How long does it take you to do a straight copy of this file?

I generated a 600MB test TIFF on my system here, and here is what
I got:

Code:
% time ./exiftool Untitled-1.tif -xmp:author=phil
    1 image files updated
1.012u 6.075s 1:02.47 11.3%     0+0k 0+40io 0pf+0w
% time cp Untitled-1.tif a.tif
0.005u 2.328s 1:03.41 3.6%      0+0k 0+58io 0pf+0w

On my system, rewriting the file with ExifTool took 62.47 secs, but
using the copy command to copy the file took 63.41 secs.  So I'm
pretty happy with the ExifTool performance here. Smiley

- Phil
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[Originally posted by binouch on 2006-11-13 15:47:10-08]

Ok - so i remember reading that ExifTool copies the file first before writting new tags. I hadn't really paid much attention to that, but looking at it closer i see that it recreates a new file and keeps the old one there. It looks like it's somewhat of a security feature you put there - would it be possible to go around that meaning - can i write to the file directly without copying it first; as you can guess working with files that big if i make a copy every time i write meta data my file system will be full very quickly; and at the same time the date on the file is going to be different - that kind of defeats the purpose of putting meta data if the "creation" date isn't accurate.
What do you think the solution could be for that?

Thank you:)

Ben
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[Originally posted by exiftool on 2006-11-13 15:59:23-08]

ExifTool doesn't "copy" the file, it just writes it to an output file
with a different name when it modifies the information.  You can
force it to overwrite the original with the -overwrite_original or
-overwrite_original_in_place options, but you should maintain
your own backups if you do this.  And you can use the -P
option to preserve the original creation date of the image.
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:57 AM
[Originally posted by binouch on 2006-11-13 16:11:48-08]

Cool - that's great. Thank you Phil, what i was thinking after sending you that last question was eventually to capture the dates from the file before exiftool writes new tag info and then inclulde that in the new modification but those fields might be not writtable.
Are there any other fields that are modified when the new output file is created?

Thank you .

Ben
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:58 AM
[Originally posted by exiftool on 2006-11-13 16:59:24-08]

Hi Ben,

No meta information is modified when you rewrite a file unless
you specifically write a new value.  The -P option preserves the
file system creation date, which is a property of the filesystem and
not data within the file.  Other filesystem properties in general will
not be preserved, but any real information will.  These properties
include read/write permissions, icon location, etc.  The
-overwrite_original_in_place option is designed to preserve
as many of these other filesystem properties as possible, but in
general the filesystem information is not handled by exiftool.

I'm sure this isn't the answer you expected, but hopefully now
you understand a bit more about what is going on.

- Phil
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:58 AM
[Originally posted by binouch on 2006-11-13 17:23:24-08]

Thank you Phil

Indeed i do understand what goes on under the hood a little better now.
I don't want to seem insistant about this but if one uses the -overwrite_original_in_place option why is it necessary to write a new output file. Would it be possible to to just go write a new tag or a new value for a tag and that's all?
The reason why i'm asking is because if this is ran using a script from the command line - it's fine i don't really mind it taking over a minute per large file, but if i build a GUI for this for a user to be able to dynamically edit the meta data of a file, waiting over a minute for an update won't work.
I don't know if you had that in mind when you wrote this module.

Thanks,

Ben

PS: i just noticed you can put line break tags in the text - hehehehe
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:58 AM
[Originally posted by exiftool on 2006-11-13 18:00:31-08]

Hi Ben,

I think the -overwrite_original_in_place option name
may be a bit misleading.   When the "in_place" option is used, an
extra step is added where the final image is copied to overwrite
the original.  So this would slow you down by a factor of 2, and
is definitely not what you want.

While there are some tricks which can be taken to avoid rewriting
a TIFF file completely, these tricks in general will result in wasted space
within the image, so the image size will continue to grow and grow
if it is edited repeatedly.  ExifTool does not use these tricks.

There is also a technique for specifically rewriting XMP information
in place, since the specification suggests adding a couple of kilobytes
of blank data to allow the XMP record a bit of room to grow before
the file need rewriting.  ExifTool does not take advantage of this either.

I don't rule out the possibility of adding specific tricks like this in the
future, but right now ExifTool uses a more general approach to editing
the meta information -- one that works for all situations.

- Phil
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:58 AM
[Originally posted by binouch on 2006-11-13 19:35:41-08]

Well even though i guess having a graphical user interface for editing meta data and keeping the header "organized" are not really compatible, i like the fact that the header remains "small". I'll stay posted on your site to see if you include some of those "tricks" in the future. Out of curiosity do those tricks include what the XMP toolkit form Adobe does?

Thank you very much for your help Phil. Smiley
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:58 AM
[Originally posted by binouch on 2006-11-13 20:28:13-08]

Well even though i guess having a graphical user interface for editing meta data and keeping the header "organized" are not really compatible, i like the fact that the header remains "small". I'll stay posted on your site to see if you include some of those "tricks" in the future. Out of curiosity do those tricks include what the XMP toolkit form Adobe does?

Thank you very much for your help Phil. Smiley
Title: Re: Adding additional unknown tags to existing images
Post by: Archive on May 12, 2010, 08:53:58 AM
[Originally posted by exiftool on 2006-11-13 21:27:30-08]

I haven't used the Adobe XMP toolkit, but you would be able to tell
by the write speed with a large TIFF like yours if they are using
some tricks to avoid rewriting the entire image.  It would be
interesting to know if they do.