2020.02.03 16:30 "[Tiff] Problem with 4.1.0 of libtiff.", by David C. Partridge

2020.02.04 01:11 "Re: [Tiff] Problem with 4.1.0 of libtiff.", by David C. Partridge

I've been doing some more digging:

TIFFScanlineSize(m_tiff) is returning ZERO even though m_tiff->tif_scanlinesize is 14784 (which is correct for the 4928 wide image).

Here's my client code:

                tmsize_t                lScanLineSize;
                VOID *                  pScanLine;

if (m_pProgress)
        m_pProgress->Start2(nullptr, h);

lScanLineSize = TIFFScanlineSize(m_tiff);

ZTRACE_DEVELOP("TIFF Scan Line Size %d", lScanLineSize);

ZTRACE_DEVELOP("TIFF spp=%d, bpp=%d, w=%d, h=%d", spp, bpp, w, h);

pScanLine = (VOID *)malloc(lScanLineSize);
if (pScanLine)
{
        bResult = TRUE;
        for (LONG j = 0;j<h && bResult;j++)
        {

                                BYTE *  pBYTELine       = (BYTE *)pScanLine;
                                WORD *  pWORDLine       = (WORD *)pScanLine;

                                DWORD * pDWORDLine      = (DWORD *)pScanLine;
                                float * pFLOATLine      = (float *)pScanLine;

                                int                     nResult;

                nResult = TIFFReadScanline(m_tiff, pScanLine, j);
                if (1 != nResult)
                {
                        ZTRACE_RUNTIME("TIFFReadScanLine returned an error");
                        bResult = false;
                }

Trace shows:

00000091 2020/02/03 18:41:39.305 033948 0000b21c               >TIFF Scan Line Size 0
00000092 2020/02/03 18:41:39.324 033948 0000b21c               >TIFF spp=3, bpp=8, w=4928, h=3280
00000093 2020/02/03 18:41:39.334 033948 0000b21c               >TIFFReadScanLine returned an error

David

Sorry I didn't send my reply to the list.

Here's what I sent incorrectly to Bob.

Here is what I think you are asking for...

Built static libraries myself using same compile options as for previous release. Copied files from 4.1.0 directory into my build tree to replace earlier version of the code. I then copied tif_config.vc.h to tif_config.h and tiffconf.vc.h to tiffconf.h as per the nmake file.

Code is built on Windows 10 64 bit using Visual Studio 2017

Application is built for both 32 and 64 bit.

64 bit debug compile options:

/MP /GS /W3 /Zc:wchar_t /I".\" /I"../libjpg/" /I"..\ZLib" /I"C:\Program Files (x86)\Visual Leak Detector\include" /Zi /Gm- /Od /Ob0 /Fd".\x64\Debug\libtiff.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "WIN32" /D "_LIB" /D "_CRT_NONSTDC_NO_WARNINGS" /D "_CRT_SECURE_NO_WARNINGS" /D "USE_LIBTIFF_STATIC" /D "_VC80_UPGRADE=0x0600" /D "_USING_V110_SDK71_" /D "_UNICODE" /D "UNICODE" /D "_AFXDLL" /errorReport:prompt /WX /Zc:forScope /RTC1 /GR /Gd /Oy- /MDd /FC /Fa".\x64\Debug\" /EHsc /nologo /Fo".\x64\Debug\" /Fp".\x64\Debug\libtiff.pch" /diagnostics:classic

32 bit debug compile options:

/MP /GS /analyze- /W3 /Zc:wchar_t /I".\" /I"../libjpg/" /I"..\ZLib" /I"C:\Program Files (x86)\Visual Leak Detector\include" /Zi /Gm- /Od /Ob0 /Fd".\x86\Debug\libtiff.pdb" /Zc:inline /fp:precise /D "_DEBUG" /D "WIN32" /D "_LIB" /D "_CRT_NONSTDC_NO_WARNINGS" /D "_CRT_SECURE_NO_WARNINGS" /D "USE_LIBTIFF_STATIC" /D "_VC80_UPGRADE=0x0600" /D "_USING_V110_SDK71_" /D "_UNICODE" /D "UNICODE" /D "_AFXDLL" /errorReport:prompt /WX /Zc:forScope /RTC1 /GR /Gd /Oy- /MDd /FC /Fa".\x86\Debug\" /EHsc /nologo /Fo".\x86\Debug\" /Fp".\x86\Debug\libtiff.pch" /diagnostics:classic

tif_win32.c isn't part of the build and this is what's in tiffio.h:

/*
 * On windows you should define USE_WIN32_FILEIO if you are using
tif_win32.c

 */

#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows) # if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)

# define AVOID_WIN32_FILEIO
# endif
#endif

The file I was testing with worked fine in the earlier release of libtiff.

the file I was using for the test data was this one:

D:\tiff-4.1.0\tools>tiffdump "d:\users\amonra\Documents\Astrophotography\DSS Test Images\TIF_Test_Nikon_D4s\DSC_0782_ISO_00400.TIF" d:\users\amonra\Documents\Astrophotography\DSS Test

Images\TIF_Test_Nikon_D4s\DSC_0782_ISO_00400.TIF:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 8 (0x8) next 13364 (0x3434)
ImageWidth (256) LONG (4) 1<4928>
ImageLength (257) LONG (4) 1<3280>
BitsPerSample (258) SHORT (3) 3<8 8 8>
Compression (259) SHORT (3) 1<1>
Photometric (262) SHORT (3) 1<2>
Make (271) ASCII (2) 18<NIKON CORPORATION\0>
Model (272) ASCII (2) 10<NIKON D4S\0>
StripOffsets (273) LONG (4) 1<1846784>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<3>
RowsPerStrip (278) LONG (4) 1<3280>
StripByteCounts (279) LONG (4) 1<48491520>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>

Software (305) ASCII (2) 10<Ver.1.10 \0> DateTime (306) ASCII (2) 20<2019:08:18 17:40:32\0> Artist (315) ASCII (2) 37<M.E. Gielis\0\0\0\0\0\0\0\0\0\0\0\0\0 ...> 700 (0x2bc) BYTE (1) 12288<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>

Copyright (33432) ASCII (2)
55<\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 ...>
34665 (0x8769) LONG (4) 1<12764>
34853 (0x8825) LONG (4) 1<13344>

Directory 1: offset 13364 (0x3434) next 0 (0)
ImageWidth (256) LONG (4) 1<160>
ImageLength (257) LONG (4) 1<120>
BitsPerSample (258) SHORT (3) 3<8 8 8>
Compression (259) SHORT (3) 1<1>
Photometric (262) SHORT (3) 1<2>
StripOffsets (273) LONG (4) 1<13552>
SamplesPerPixel (277) SHORT (3) 1<3>
RowsPerStrip (278) LONG (4) 1<120>
StripByteCounts (279) LONG (4) 1<57600>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>

D:\tiff-4.1.0\tools>

David