Hello,
I am trying to use several threads to convert images from Nikon's NEF format to TIFF using ImgSource v5 and SARAW 2.2 (both are the latest versions), but the resulting images are corrupt. This works if I convert a single image at a time, but not when I run multiple threads...
I initialise the libraries once using:
is5_Initialize();
SARAW_Initialize();
Then on each thread I set the hooks using:
if (HISEXTHK hHk = is5_GetExtHook(0))
{
SARAW_SetImgSourceHooks(hHk);
GlobalFree(hHk);
}
and then convert the NEF image to TIFF using:
if (HISSRC hSrc = is5_OpenFileSourceW(pNefFile))
{
UINT32 uiW = 0;
UINT32 uiH = 0;
if (HGLOBAL hImg = SARAW_ReadRAW(hSrc, &uiW, &uiH, 24, 1.0, 3, -1, 0, 0, 0, 0, (1<< 9)))
{
if (HISDEST hDest = is5_OpenFileDestW(pTiffFile, FALSE))
{
is5_WriteTIFF(hDest, (BYTE*) hImg, uiW, uiH, 24, uiW*3, 0, 1, 0, 0);
is5_CloseDest(hDest);
}
GlobalFree(hImg);
}
is5_CloseSource(hSrc);
}
Can anyone see what I have done wrong please?