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
July 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.07.14 04:09 "The problem of Convert tiff", by Robert Zhang
2006.07.14 04:41 "Re: The problem of Convert tiff", by Joris Van Damme
2006.07.14 05:47 "Re: The problem of Convert tiff", by Robert Zhang
2006.07.14 07:36 "Re: The problem of Convert tiff", by Joris Van Damme
2006.07.14 14:08 "Re: The problem of Convert tiff", by Bernie Pallek

2006.07.14 07:36 "Re: The problem of Convert tiff", by Joris Van Damme

Robert Zhang wrote:
> I convert Tiff  with LibTiff. I develop tiff for the Dialogic.
> The Dialogic require the tiff of TIFF/F class. So i must convert the
> all format of tiff  to   TIFF/F class.

I've never thought highly of the artificial classification of TIFF, but,
as far as that classification makes any sense, I think your source image
already is TIFF/F.

> strTime.Format("%d-%2d-%2d...

This is where the bogus format for the DateTime tag comes from. Look up
the correct format in the TIFF spec. It's not crucial, but you may as
well get it right.

> TIFFGetField(srcImage,TIFFTAG_ROWSPERSTRIP,&rowperstrip);

You read the RowsPerStrip value from the source image, you next set that
same value on the destination image...

>   TIFFSetField(image, TIFFTAG_ROWSPERSTRIP,rowperstrip);

...and next transcode all individual strips...

>   uint32 rowsperstrip;
>   (void) TIFFGetFieldDefaulted(srcImage, TIFFTAG_ROWSPERSTRIP,
>   &rowsperstrip); tstrip_t s, ns = TIFFNumberOfStrips(srcImage);
>   uint32 row = 0;
>   for (s = 0; s < ns; s++) {
>    tsize_t cc = (row + rowsperstrip > lv) ?
>     TIFFVStripSize(srcImage, lv - row) : stripsize;
>    TIFFReadEncodedStrip(srcImage, s, buf, cc);
>    if (TIFFWriteEncodedStrip(image, s, buf, cc) < 0) {
>     _TIFFfree(buf);
>    }
>    row += rowsperstrip;
>   }
>   TIFFWriteDirectory(image);
>   _TIFFfree(buf);

That seems OK, at first sight. Maybe someone else spots an error. If
not, try moving the line where you set the TIFFTAG_ROWSPERSTRIP value of
the destination image someplace else, like right before or right after
the line where you set PLANARCONFIG, sometimes that makes a difference.
Try doing the same with the setting of IMAGELENGTH.


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