Blame contrib/win_dib/README.Tiffile

Packit 7838c8
Frank,
Packit 7838c8
Packit 7838c8
I attached a file that uses RGBA interface (tif_getimage.c) to read a tiff
Packit 7838c8
file and convert to a DIB.  It's advantage is that it is easy to read *any*
Packit 7838c8
tiff file suported by libtiff and easily convert it to a DIB.  The disadvantage
Packit 7838c8
is that bilevel (B&W) bitmaps (and all other non-rgba images) are also 
Packit 7838c8
converted to RGBA, thus taking up 32x as much memory as needed (4 bytes per 
Packit 7838c8
pixel, rather than 1 bit).  I read tiff files, but don't need to
Packit 7838c8
write them.  And my files are typically small, so the overhead is mostly
Packit 7838c8
inconsequential.  But for bilevel images, I overrode the get() and put()
Packit 7838c8
routines of the RGBA interface to just copy the data from the input raster
Packit 7838c8
to the output raster, rather than expanding out to full 32 bit format.  It
Packit 7838c8
would be nice if there were a simple way to handle all palletized images,
Packit 7838c8
but that would take more custom routines, and it's not that important to me.
Packit 7838c8
Packit 7838c8
Usage:
Packit 7838c8
Packit 7838c8
    m_pDIB = (PBITMAPINFOHEADER)::ReadTIFF(pathName);
Packit 7838c8
    if (m_pDIB != 0) {
Packit 7838c8
       m_format = IMAGETYPE_TIF;
Packit 7838c8
    }
Packit 7838c8
Packit 7838c8
This is intended as Win32, but the modifications for new get() and put()
Packit 7838c8
routines may be independent of platform.
Packit 7838c8
Packit 7838c8
Thanks for your work supporting the forum and the library!
Packit 7838c8
Packit 7838c8
Regards,
Packit 7838c8
Packit 7838c8
Mark James
Packit 7838c8
mark@james.net