error with Tiff files due to libTiff?

Augur augur09 at gmail.com
Wed Jun 25 08:27:58 PDT 2008


Hi,

first, thank you for writing Exempi lib. Xmp is really cool, and a
linux version was really missing.

I work on linux debian Etch 64 bits (the problem occurs also on 32
bits). I've got a strange issue when adding meta data to Tiff files
with Exempi 2.0.1. I just load Xmp from file, and later, serialize it
back to the file (without changing anything on Xmp object). I use the
package libtiff4-dev (and link on the static tiff lib). My code is
something like:

/// exempi_test.cpp

#include "exempi/xmp.h"
#include "exempi/xmpconsts.h"
#include <iostream>

XmpPtr   _xmp;

void       read( const std::string& filename )
{
	XmpFilePtr	file = xmp_files_open_new( filename, XMP_OPEN_ONLYXMP );
	_xmp = xmp_files_get_new_xmp( file );

	if (_xmp == NULL)
	{
		std::cerr << "No meta data in file, or file format not supported, "
				 << "or invalid file name: " << filename << std::endl;
		_xmp = xmp_new_empty();
		return false;
	}

	xmp_files_close( file, XMP_CLOSE_NOOPTION );
	xmp_files_free( file );
}

void     save( const std::string& filename )
{
	XmpFilePtr	file = xmp_files_open_new( filename, XMP_OPEN_FORUPDATE );

	if (xmp_files_can_put_xmp( file, _xmp ))
	{
		xmp_files_put_xmp( file, _xmp );
	}

	xmp_files_close( file, XMP_CLOSE_SAFEUPDATE );
	xmp_files_free( file );
}

int main()
{
    load( "foo.tif" );
    save( "foo.tif" );

    return 0;
}


First, I generate a foo.tif file (eg. with gimp), with no meta data.
Then I execute my little application, Xmp meta data are added in the
tiff header. The problem comes when I try to execute my application
again (or try to use any external application using LibTiff), when
reading foo.tif, I've got the message: "TIFFReadDirectory: Warning,
foo.tif: wrong data type 7 for "Photoshop"; tag ignored.". It is just
a warning, the image is still correct.

Do you know this issue? Is it a bug from libTiff, or a problem when
Exempi write Xmp meta data to Tiff file?

Here is what tiffinfo give me about my file (you can see the error
message on first line):

[augur at home] tiffinfo foo.tif
TIFFReadDirectory: Warning, foo.tif: wrong data type 7 for
"Photoshop"; tag ignored.
TIFF Directory at offset 0xd6b6a (879466)
  Image Width: 720 Image Length: 576
  Bits/Sample: 8
  Sample Format: unsigned integer
  Compression Scheme: LZW
  Photometric Interpretation: RGB color
  Samples/Pixel: 4
  Rows/Strip: 1
  Planar Configuration: single image plane
  XMLPacket (XMP Metadata):
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Exempi + XMP Core 4.1.1">
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
    xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
    xmlns:exif="http://ns.adobe.com/exif/1.0/"
   tiff:NativeDigest="256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;3BEE3D831C19EBA51A5CEE666C98F6FF"
   exif:NativeDigest="36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;E4C23762ED2823A27E62A64B95C024E7"/>
 </rdf:RDF>
</x:xmpmeta>





















<?xpacket end="w"?>


Thanks for your help.

-- 
Augur


More information about the Exempi-devel mailing list