在.NET中打开巨大的TIF和部分复制到新形象 [英] Open huge TIF in .NET and copy parts to new image
问题描述
我在寻找一个可以打开并复制了大量TIFF文件的部分库。我看着 LibTiff.Net 它很快打开了文件,但它不具备种植任何功能或复制图像的部分。我的形象是100000×10万像素以上,并创建一个 System.Drawing.Bitmap
的大小崩溃的应用程序,以便转换为位图
第一个是不是一种选择。
I'm looking for a library that can open and copy sections of a large TIFF file. I've looked at LibTiff.Net which opens the file very quickly but it doesn't have any functions for cropping or copying sections of the image. My image is 100,000 x 100,000 pixels upwards and creating a System.Drawing.Bitmap
of that size crashes the application so converting to a Bitmap
first is not an option.
谁能推荐一个.net库?
Can anyone recommend a .NET library?
推荐答案
如果你的文件小于4GB的磁盘的比我建议你再看看LibTiff.Net。即使有这样大的图像,你有一些选择。
If your file is less than 4GB on disk than I recommend you to take another look at LibTiff.Net. Even with such large images you have some options.
首先,检查你的图像是否平铺或剥离。 Tiff.IsTiled
方法会给你答案。
First of all, check whether your image is tiled or stripped. Tiff.IsTiled
method will give you the answer.
如果您的图片平铺,比使用 ReadScanline
方法,你可能不应该读它。它可能是更好的使用读进来codedTile
在这种情况下的方法。
If your image is tiled, than you probably shouldn't read it using ReadScanline
method. It might be better to use ReadEncodedTile
method in that case.
如果您的图片被剥离,比你可以用 ReadScanline
和读进来codedStrip
方法来读取它。
If your images is stripped, than you can use ReadScanline
and ReadEncodedStrip
methods to read it.
如果你想用的东西,希望 System.Drawing.Bitmap
不是试图用 ReadRGBATile
或 ReadRGBAStrip
。这些方法可以用来创建从图像的部分位图。没有这个没有样品,但是的颜色转换为TIFF 32位System.Drawing.Bitmap 应该给你几乎所有有关如何转换图像的瓷砖或钢带进行位图所需的信息。
If you want to use something that expects System.Drawing.Bitmap
than try using ReadRGBATile
or ReadRGBAStrip
. These methods can be used to create bitmaps from portions of your image. There is no sample for this, but Convert color TIFF to a 32-bit System.Drawing.Bitmap should give you almost all required information about how to convert tile or strip of an image to a bitmap.
编辑:
LibTiff.Net 2.4.508增加了支持BigTiff所以也支持大于4GB的文件。
LibTiff.Net 2.4.508 adds support for BigTiff so files larger than 4GB are also supported.
这篇关于在.NET中打开巨大的TIF和部分复制到新形象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!