libgdk_pixbuf, VC++ and TIFF files.



As I've mentioned before, I'm in the process of building libgtk-win32 for Windows, using Visual C++.  
Although it's been relatively easy I didn't begin testing my build until yesterday.  One of the first 
libraries I wanted to test was libgdk_pixbuf and its various loaders.  The first few loaders I tried (BMP, 
PNG and JPEG) all went smoothly.  Then I came to TIFF....

gdk_pixbuf_new_from_file() opens the specified file using g_fopen() which in turn, calls _wfopen().  This 
returns a FILE*.  Next, _gdk_pixbuf_generic_image_load() gets used to read the subsequent TIFF data.  That 
process starts with the FILE* getting sent to _fileno() which returns a 'C' run time file handle.  That file 
handle eventually gets passed to TIFFFdOpen() which in turn, calls TIFFClientOpen() to read in the TIFF 
header.
 
I suppose there must be several versions of the TIFF library around by now but my version came with the 
generic 'FreeImage' library.  That version provides read & write modules for servicing different platforms 
(Apple / Acorn / *nix / Win32 etc).  Unfortunately, the Win32 version tries to read the TIFF header courtesy 
of the Windows function 'ReadFile()'.  AFAIK, ReadFile() will only accept file handles returned from 
CreateFile() - not from fopen() or _wfopen().  Consequently, libgdk_pixbuf fails to read the TIFF data (on 
Win32/VC++) because it used g_fopen() to open the file, instead of using TIFF's own TIFFOpen() function, 
which would have opened the file using CreateFile().
 
It's not easy to say whose fault this is (and it'll almost certainly be easier to fix in the TIFF library) 
but I thought I'd flag it up here anyway.
 
I suppose it's entirely possible that this problem might be fixed in some other version of libTIFF.  Is there 
a recommended version of libTIFF that I could try with libgdk_pixbuf instead of the FreeImage version?

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]