Problem writing IPTC to TIFF files

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

Previous topic - Next topic

Archive

[Originally posted by mella on 2006-09-27 14:27:32-07]

Hi,

Im trying to write IPTC information back to TIFF (both types: Uncompressed and LZW) files and just cant get it work.

It works fine with JPEG files.

Im using perl module Image::ExifTool to do this.

Code:
my ($success, $errStr) = $image->SetNewValue($key, $value);
this returns 1 and is ok.

Code:
my $write_return = $image->WriteInfo($old_image_path, $image_path);
this always returns 0 when file is TIF and information will not be written.

What I am doing wrong or what i'm missing?

Meelis

Archive

[Originally posted by exiftool on 2006-09-27 16:13:15-07]

When WriteInfo() returns a zero, call GetValue('Error') to obtain the error message.

Two errors that could be causing this problem are a format error in the TIFF file, or if the output file already exists.

- Phil

Archive

[Originally posted by mella on 2006-09-28 09:04:36-07]

I checked this error message and got this: "Internal error writing IFD0:IPTC-NAA".

What it means, what I can do about it?

But sometimes (example LZW compressed TIFF) it returns 1 and I still cannot find that IPTC info is updated - it is same like before rewriting it.

Meelis

Archive

[Originally posted by exiftool on 2006-09-28 11:31:33-07]

Something funny is going on.  You should not get that error.

If you can send me a copy of the image and the script you are using, I can figure out what is going wrong.  (send to phil @ owl.phy.queensu.ca, thanks)

- Phil

Archive

[Originally posted by exiftool on 2006-09-28 14:00:49-07]

Thanks for the samples.

There are format problems with both of those TIFF images.  If I try to set an IPTC tag using 'exiftool', I get this:

Code:
% exiftool tmp -iptc:headline=test    
Warning: [minor] Unrecognized data in IPTC trailer - tmp/test_iptc.tif
Error: Internal error writing IFD0:IPTC-NAA - tmp/test_iptc.tif
Error: [minor] 144 unreferenced bytes at end of file not copied - tmp/test_iptc_lzw.tif
    1 directories scanned
    0 image files updated
    2 files weren't updated due to errors

The first image (test_iptc.tif) has two IPTC records.  The first one (in the standard location) has an invalid entry or has been corrupted somehow.  The second one (in the Photoshop information) seems to be OK, but there is still a problem because IPTC shouldn't be found inside the Photoshop information of a TIFF image.

The second image has an unknown trailer containing IPTC information which is not referenced from the TIFF file.

What software was used to generate these images?

Even with these errors, ExifTool can be used to edit both images by setting the "IgnoreMinorErrors" option (equivalent to the "-m" command-line option):

Code:
% exiftool tmp -iptc:headline=test -m    
Warning: 156 unreferenced bytes at end of file not copied - tmp/test_iptc.tif
Warning: 144 unreferenced bytes at end of file not copied - tmp/test_iptc_lzw.tif
    1 directories scanned
    2 image files updated
% exiftool tmp -iptc:headline -a    
======== tmp/test_iptc.tif
Headline                        : test
Headline                        : headline uncompressed TIF
======== tmp/test_iptc_lzw.tif
Headline                        : test
    1 directories scanned
    2 image files read

As you can see, the new Headline was written (in the standard location) to both images.  But there is still a problem.  The duplicate IPTC record in the Photoshop information of the first image was not updated.  (For speed reasons, ExifTool does not rewrite information unless necessary, and since it doesn't expect to find IPTC in the Photoshop record of a TIFF image, it doesn't parse this record.) So I suggest you delete the photoshop information from these images, as well as setting the IgnoreMinorErrors flag:

Code:
$exiftool->Options(IgnoreMinorErrors => 1);
$exiftool->SetNewValue('photoshop:all' => undef);

I hope this helps

- Phil

Archive

[Originally posted by mella on 2006-09-28 16:27:59-07]

Hi!

If I use IgnoreMinorErrors then it seems to work!

Software for writing IPTC information is Fotoware Fotostation. After writing some IPTC information, TIF file started to give errors (which were described previous letters)

Probably Fotostation writes IPTC information into some different place (I also cannot read Fotostation IPTC information from LZW compressed TIFF files).

Meelis