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