Кодеки: Как конвертировать JBIG2 в TIFF?
В этом разделе
VintaSoft Imaging .NET SDK позволяет конвертировать JBIG2-файл в TIFF-файл используя класс
DocumentConverter или
ImageCollection. Использование класса
DocumentConverter обеспечивает наилучшую производительность, поскольку класс
DocumentConverter использует многопоточность.
Вот C#/VB.NET код, который демонстрирует, как преобразовать JBIG2-файл в TIFF-файл с помощью класса
DocumentConverter:
/// <summary>
/// Converts JBIG2 file to a TIFF file using Vintasoft.Imaging.DocumentConverter class.
/// </summary>
public static void ConvertJbig2ToTiff_DocumentConverter(string jbig2FileName, string tiffFileName)
{
Vintasoft.Imaging.DocumentConverter.Convert(jbig2FileName, tiffFileName);
}
''' <summary>
''' Converts JBIG2 file to a TIFF file using Vintasoft.Imaging.DocumentConverter class.
''' </summary>
Public Shared Sub ConvertJbig2ToTiff_DocumentConverter(jbig2FileName As String, tiffFileName As String)
Vintasoft.Imaging.DocumentConverter.Convert(jbig2FileName, tiffFileName)
End Sub
Вот C#/VB.NET код, который демонстрирует, как преобразовать JBIG2-файл в TIFF-файл с помощью класса
ImageCollection:
public static void ConvertJbig2ToTiff_ImageCollection(string jbig2FileName, string tiffFileName)
{
// create image collection
using (Vintasoft.Imaging.ImageCollection imageCollection =
new Vintasoft.Imaging.ImageCollection())
{
// add JBIG2 file to collection
imageCollection.Add(jbig2FileName);
// create Tiff encoder
using (Vintasoft.Imaging.Codecs.Encoders.TiffEncoder tiffEncoder =
new Vintasoft.Imaging.Codecs.Encoders.TiffEncoder())
{
// set Tiff compression to ZIP
tiffEncoder.Settings.Compression =
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffCompression.Zip;
// add pages of JBIG2 document to TIFF file using Tiff encoder
imageCollection.SaveSync(tiffFileName, tiffEncoder);
}
}
}
Public Shared Sub ConvertJbig2ToTiff_ImageCollection(jbig2FileName As String, tiffFileName As String)
' create image collection
Using imageCollection As New Vintasoft.Imaging.ImageCollection()
' add JBIG2 file to collection
imageCollection.Add(jbig2FileName)
' create Tiff encoder
Using tiffEncoder As New Vintasoft.Imaging.Codecs.Encoders.TiffEncoder()
' set Tiff compression to ZIP
tiffEncoder.Settings.Compression = Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffCompression.Zip
' add pages of JBIG2 document to TIFF file using Tiff encoder
imageCollection.SaveSync(tiffFileName, tiffEncoder)
End Using
End Using
End Sub