AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2002.02.02 08:47 "RGBA", by Siddhartha
2002.02.02 19:11 "RE: RGBA", by Mark A. James

2002.02.02 19:11 "RE: RGBA", by Mark A. James

Sid,

Depending on your needs, this might work.

I attached a file that uses RGBA interface (tif_getimage.c) to read a tiff file and convert to a DIB. It's advantage is that it is easy to read *any* tiff file suported by libtiff and easily convert it to a DIB. The disadvantage is that bilevel (B&W) bitmaps (and all other non-rgba images) are also converted to RGBA, thus taking up 32x as much memory as needed (4 bytes per pixel, rather than 1 bit). I read tiff files, but don't need to write them. And my files are typically small, so the overhead is mostly inconsequential. But for bilevel images, I overrode the get() and put() routines of the RGBA interface to just copy the data from the input raster to the output raster, rather than expanding out to full 32 bit format. It would be nice if there were a simple way to handle all palletized images, but that would take more custom routines, and it's not that important to me.

As far as displaying in windows, see the example program DIBLOOK that came with MFC. You can also do a multifile search (essentially a recursive grep) for BITMAPHEADERINFO in the vc++ source and includes for more examples.

Regards,

Mark