WPF:JPEG压缩的TIFF图像?

时间:2021-04-16 21:16:33

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.

我有大量的TIFF图像,我需要在WPF程序中使用(特别是.NET 3.5 SP1并使用C#)。一半的TIFF文件包含使用JPEG压缩编码的彩色图像,它们不适用于WPF。 “Microsoft Office Document Imaging”应用程序可以正常处理文件。由于Windows本身并不喜欢它们(例如,不能生成缩略图),我认为这是标准Windows Imaging Components(WIC)库中的限制。

Does anyone have any ideas on how to correctly read the TIFF images that are using JPEG compression with the standard .NET/WPF libraries?

有没有人对如何正确读取使用标准.NET / WPF库的JPEG压缩的TIFF图像有任何想法?

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?

或者有没有人知道WIC的任何备用第三方TIFF编解码器,我可以用它来解决这个问题?

Or finally are there any alternate .NET libraries for TIFF files that are still easily usable with WPF?

或者最后是否还有可用于WPF的TIFF文件的备用.NET库?

Thanks!

3 个解决方案

#1


1  

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.

TIFF包装的JPEG有两种形式 - 类型6和类型7.您所描述的是类型6 TIFF。虽然Adobe多年来一直建议不使用此类型(详情请参阅技术说明2),但仍有几个图形包使用它。

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.

我知道.NET的一些商业图形软件包可以读取它们,例如Captiva ISIS PixTools(以前的Pixtran)库,但不知道任何开源或其他免费的。

#2


1  

What WPF API are you using to handle them?

您使用什么WPF API来处理它们?

Have you tried using TiffBitmapDecoder from the System.Windows.Media.Imaging namespace?

您是否尝试过使用System.Windows.Media.Imaging命名空间中的TiffBitmapDecoder?

#3


1  

You will need to upgrade to either Windows 7, Windows Server 2008 (or newer) in order to open these files natively.

您需要升级到Windows 7,Windows Server 2008(或更高版本)才能本机打开这些文件。

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.

Libtiff(C ++)和LibTIFF.NET(.Net)应该能够打开这些文件。请确保在构建其中一个库时,在构建中启用了TIFF_JPEG(包括6和7)。默认构建设置中禁用这些格式。

#1


1  

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.

TIFF包装的JPEG有两种形式 - 类型6和类型7.您所描述的是类型6 TIFF。虽然Adobe多年来一直建议不使用此类型(详情请参阅技术说明2),但仍有几个图形包使用它。

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.

我知道.NET的一些商业图形软件包可以读取它们,例如Captiva ISIS PixTools(以前的Pixtran)库,但不知道任何开源或其他免费的。

#2


1  

What WPF API are you using to handle them?

您使用什么WPF API来处理它们?

Have you tried using TiffBitmapDecoder from the System.Windows.Media.Imaging namespace?

您是否尝试过使用System.Windows.Media.Imaging命名空间中的TiffBitmapDecoder?

#3


1  

You will need to upgrade to either Windows 7, Windows Server 2008 (or newer) in order to open these files natively.

您需要升级到Windows 7,Windows Server 2008(或更高版本)才能本机打开这些文件。

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.

Libtiff(C ++)和LibTIFF.NET(.Net)应该能够打开这些文件。请确保在构建其中一个库时,在构建中启用了TIFF_JPEG(包括6和7)。默认构建设置中禁用这些格式。