By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,060 Members | 1,906 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,060 IT Pros & Developers. It's quick & easy.

graphics programming with tiff

P: n/a

Hi,

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

thanks alot

--
wayne
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"wayne" <wa**********@mail.codecomments.com> wrote:
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/de...classtopic.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.
--
Derrick Coetzee, Microsoft Speech Server developer
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included code samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Nov 17 '05 #2

P: n/a
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

"Derrick Coetzee [MSFT]" <dc******@online.microsoft.com> wrote in message
news:%2*****************@TK2MSFTNGP12.phx.gbl...
"wayne" <wa**********@mail.codecomments.com> wrote:
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/de...classtopic.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.
--
Derrick Coetzee, Microsoft Speech Server developer
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included code samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.