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 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

Archive

[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

Archive

[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

Archive

[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.

Archive

[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

Archive

[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

Archive

[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

Archive

[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

Archive

[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

Archive

[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

Archive

[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.