Can't write zero length Artist in IFD0

Started by Archive, May 12, 2010, 08:54:27 AM

Previous topic - Next topic

Archive

[Originally posted by bogdan on 2008-11-02 14:22:26-08]

Hi Phil,

When using
Code:
exiftool -TagsFromFile -exif:all source.CR2 dest.JPG
-I get "Warning: Can't write zero length Artist in IFD0" -where Artist tag isn't written (as warned).

I can understand, that writting/copying empty tag doesn't make much sense. What wonders me is, in the same source file, there are at least two tags defined (IFD0:Copyright and ExifIFD:UserComment), which seems to be empty too -but are written when using TagsFromFile.

What am I missing here?

It isn't big deal, but one would expect (when using TagsFromFile), all defined tags inside source, will be written.

Btw. this case (zero length Artist) comes from Canon 50D raw file.

I'll use oportunity for another question.. What is the difference between:
Code:
exiftool -overwrite_original -P ...
and
Code:
exiftool -overwrite_original_in_place ...

Thanks for answering,

Bogdan

Archive

[Originally posted by exiftool on 2008-11-02 18:09:57-08]

In EXIF, I don't allow the stored value to have zero
length because I believe this goes against the EXIF
spec (but I would have to look this up again to be
sure).  This goes for all EXIF "string" format tags.
Some "undef" tags have a header identifying the
character encoding which allows a zero-length
value to be written: Since the header is always,
stored, the stored value is never zero length.

The command-line interface doesn't allow you to
set a tag to an empty value because this is the
syntax for deleting a tag.  The API, however, will
allow a zero-length tag to be written if it is valid
for the information type.  (And as I said, this is
not valid for EXIF "string" tags.)  So empty values
can be copied if they are valid.  Also, sometimes
a tag will look empty if it contains just spaces,
so you have to keep this in mind too.

The -P option only preserves the filesystem
date/time for a file, and has nothing to do with the
writing strategy for the file.  The in-place option actually
writes over top of the original file instead of renaming
a temporary file to replace the original.  So in the end
you have a modified copy of the same file, which makes
a difference on some filesystems such as the Mac which
may have icon information, etc associated with a specific
file.

I hope this all makes a bit of sense.

 - Phil

Archive

[Originally posted by bogdan on 2008-11-02 20:08:37-08]

Hi Phil,

Thanks for explaining... when I saw this (zero length), I though, you may have overlooked something, that's all. So, IFD0:Artist tag having zero length isn't within specification... as said, Canon 50D writes it that way into CR2, unless owner defines it's value in camera (AFAIK, 50D is the first Canon SLR camera, using this tag).

About -P option... I'm not sure about in_place writes "over top of original".. I'll take that as "writes into (thus, modify) existing file and preserve file attributes".

The reason why I asked is, about preserving Date of file when writing/modifying file. And as it seems, this goal is achieved i both cases (using either -P or in_place). I was just wondering which approach is faster -has less file accesses, thus, command is executed faster (may be important for batch writing).

Thanks for taking time,

Bogdan

Archive

[Originally posted by exiftool on 2008-11-03 00:28:37-08]

Hi Bogdan,

I didn't have a 50D CR2 handy when I wrote my last response,
but I checked and you are correct.  However, I forgot about
the terminating null character that is written to EXIF string
values.  So a zero-length string is stored as one byte, and
this should be allowed.  I checked my code, and I was testing
before adding the required null terminator.  Technically maybe
I should fix this -- I have to think about this a bit more.

The -overwrite_original_in_place option preserves
most things, but the file modify date will certainly change
(although the creation date won't).  The -P option
preserves the file modify date.

The -P option is fast, but the -overwrite_original_in_place
option is slow.

- Phil

Archive

[Originally posted by bogdan on 2008-11-03 05:11:20-08]

Hi,

Thanks 3-times -everything clear now:-)

Bogdan