graphics programming with tiff

  • Thread starter Thread starter wayne
  • Start date Start date
W

wayne

Hi,

May I know how to use VC++ to write a program that can read a TIFF
image file?

thanks alot
 
wayne said:
May I know how to use VC++ to write a program that can read a TIFF
image file?

If you're writing a managed application, you can simply add
System.Drawing.dll to your references and then do this:

System::Drawing::Bitmap* bm = new System::Drawing::Bitmap("foo.tif");

The Bitmap object can then be drawn or its pixel data examined. See Bitmap's
MSDN entry for more information:

http://msdn.microsoft.com/library/d...f/html/frlrfsystemdrawingbitmapclasstopic.asp

Note, however, that indexed formats are *not* supported. You would have to
first convert it to a non-indexed palette using a paint program or image
conversion tool. If you need to handle types of TIFFs that the .NET library
cannot handle, consider the LEADTOOLS Raster Imaging SDK, which supports
many additional kinds of TIFFs:

http://www.leadtools.com/SDK/Raster/Raster-Imaging.htm

Or the managed version:

http://www.leadtools.com/SDK/dotNET/RIP-for.NET.htm

If you're writing an unmanaged application, particularly if you must support
older versions of Windows, you might check out this project which uses
libtiff, a free TIFF library, to load a TIFF file into an MFC CBitmap:

http://www.codeproject.com/bitmap/BitmapsToTiffs.asp

I hope this helps.
 
In addition to the excellent answer below, you might want to look at libtiff
(libtiff.org) which isn't maintained that much anymore but does work. It's
open source (and unmanaged) but supports most (if not all) formats, and is
reasonably easily extensible.

Steve
 
Back
Top