AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
February 2006

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2006.02.06 17:12 "Mega newbie question", by Dermot Paikkos
2006.02.06 17:42 "Re: Mega newbie question", by Joris Van Damme
2006.02.07 10:26 "Re: Mega newbie question", by Dermot Paikkos
2006.02.07 11:48 "Re: Mega newbie question", by Joris Van Damme
2006.02.07 13:11 "Re: Mega newbie question", by Dermot Paikkos
2006.02.07 13:38 "Re: Mega newbie question", by Joris Van Damme
2006.02.07 15:35 "Re: Mega newbie question", by Bob Friesenhahn
2006.02.07 16:27 "Re: Mega newbie question", by Joris Van Damme

2006.02.07 11:48 "Re: Mega newbie question", by Joris Van Damme

Dermot Paikkos wrote:
> > TIFFGetField(tiff, 33424, &count, &data);
> > printf("Tag %d: %d, count %d0, 33424, *(uint32 *)data, count);
> > TIFFGetField(tiff, 36867, &count, &data);
> > printf("Tag %d: %s, count %d0, 36867, (char *)data, count);
>
> Is there a missing " mark here?

Yes, indeed.

>   int hasPSfield;
>   unsigned long imageOffset, result;
>   uint16 count;
>   void *data;
>
>   TIFF* tif = TIFFOpen("test.tif", "r");
>   if (tif == NULL) {
>         printf("Failed to open file\n");
>         exit(8);
>   }
>    TIFFGetField(tif,TIFFTAG_PHOTOSHOP &hasPSfield);
>
>    if (hasPSfield < 1) {
>       printf("No PhotoShop tag found\n");
>         exit(8);
>   }
>   TIFFGetField(tif, hasPSfield, &count, &data);
>   printf("Tag %d: %d, count %d\n", hasPSfield, *(uint32 *)data,
> count);

No, don't use TIFFGetField twice. Do it like this:

TIFF* tif = TIFFOpen("test.tif", "r");
if (tif == NULL) ...
if (TIFFGetField(tif,TIFFTAG_PHOTOSHOP,&count,&data)==0)
{
  printf("No PhotoShop tag found\n");
  exit(8);
}

/* value of Photoshop tag is count bytes long, and its value is loaded
into the memory pointed to by data */

> TIFFReadDirectory: Warning, test.tif: wrong data type 1 for
> "XMLPacket"; tag ignored.
> TIFFReadDirectory: Warning, test.tif: unknown field with tag 34665
> (0x8769) encountered.

Ignore above warnings.

BTW, I just noticed, the situation with the uint16 count is corrected
for the Photoshop tag. Declare count as uint32 instead.

I still think the general case should be uint32, instead of uint16,
though, but this should not bother you.


Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html