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