TIFF: Как преобразовать TIFF файл в BigTIFF файл?
В этом разделе
Вот C#/VB.NET код, который демонстрирует, как преобразовать TIFF файл в BigTIFF файл:
/// <summary>
/// Converts standard TIFF file to a big TIFF file (TIFF file which can be bigger than 4Gb).
/// </summary>
public void ConvertTiffToBigTiff(string tiffFileName, string bigTiffFileName)
{
// open standard TIFF file
using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiffFile =
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(tiffFileName))
{
// create big TiffFile
using (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile bigTiffFile =
new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFileFormat.LittleEndian,
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFileVersion.BigTIFF))
{
// for each page of standard TIFF file
foreach (Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffPage page in tiffFile.Pages)
// add page to a big TIFF file
bigTiffFile.Pages.Add(page);
// save big TIFF file to a disk
bigTiffFile.Save(bigTiffFileName);
}
}
}
''' <summary>
''' Converts standard TIFF file to a big TIFF file (TIFF file which can be bigger than 4Gb).
''' </summary>
Public Sub ConvertTiffToBigTiff(tiffFileName As String, bigTiffFileName As String)
' open standard TIFF file
Using tiffFile As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(tiffFileName)
' create big TiffFile
Using bigTiffFile As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFileFormat.LittleEndian, Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFileVersion.BigTIFF)
' for each page of standard TIFF file
For Each page As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffPage In tiffFile.Pages
' add page to a big TIFF file
bigTiffFile.Pages.Add(page)
Next
' save big TIFF file to a disk
bigTiffFile.Save(bigTiffFileName)
End Using
End Using
End Sub