Reputation: 2787
I have a large number of TIFF images that I’d need to use in a WPF program (.NET 3.5 SP1 specifically and using C#). Half of the TIFF files contain color images encoded using JPEG compression and they don’t work with WPF. The “Microsoft Office Document Imaging” application handles the files fine. As Windows itself doesn’t really like them either (can’t produce thumbnails for instance) I’m assuming this is a restriction in the standard Windows Imaging Components (WIC) libraries.
Does anyone have any ideas on how to correctly read the TIFF images that are using JPEG compression with the standard .NET/WPF libraries?
Or does anyone know of any alternate third party TIFF codecs for WIC that I might be able to use to work around this issue?
Or finally are there any alternate .NET libraries for TIFF files that are still easily usable with WPF?
Thanks!
Upvotes: 4
Views: 8863
Reputation: 6162
You will need to upgrade to either Windows 7, Windows Server 2008 (or newer) in order to open these files natively.
Libtiff (C++) and LibTIFF.NET (.Net) should be able to open these files. Please make sure that when you build one of these libraries, that the TIFF_JPEG (both 6 and 7) are enabled in the build. Those formats are disabled in the default build settings.
Upvotes: 1
Reputation: 14084
What WPF API are you using to handle them?
Have you tried using TiffBitmapDecoder from the System.Windows.Media.Imaging namespace?
Upvotes: 1
Reputation: 12164
TIFF-wrapped JPEGs come in two flavors - type 6 and type 7. What you are describing are the type 6 TIFFs. While Adobe has recommended for years that this type not be used (see Tech Note 2 for details), several graphics packages still use it.
I know of a few commercial graphics packages for .NET that can read them such as the Captiva ISIS PixTools (formerly Pixtran) libraries, but do not know offhand of anything open source or otherwise free.
Upvotes: 1