VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
В этом разделе
    JBIG2: Как добавить изображение в JBIG2 файл?
    В этом разделе
    Изображение можно добавить в JBIG2 файл несколькими способами.


    Вот C#/VB.NET код, который демонстрирует, как добавить изображение в JBIG2 файл с помощью класса Jbig2Encoder:
    public void AddImageToJbig2UsingJbig2Encoder(
        System.IO.Stream stream, 
        Vintasoft.Imaging.VintasoftImage image)
    {
        // add image JBIG2 file
        using (Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder encoder = 
            new Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(false))
        {
            // add image to JBIG2 file
            encoder.SaveImage(image, stream);
        }
    }
    
    Public Sub AddImageToJbig2UsingJbig2Encoder(stream As System.IO.Stream, image As Vintasoft.Imaging.VintasoftImage)
        ' add image JBIG2 file
        Using encoder As New Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(False)
            ' add image to JBIG2 file
            encoder.SaveImage(image, stream)
        End Using
    End Sub
    


    Вот C#/VB.NET код, который демонстрирует, как добавить изображение в JBIG2 файл с помощью класса Jbig2File:
    public void AddImageToJbig2UsingJbig2File(
        System.IO.Stream stream, 
        Vintasoft.Imaging.VintasoftImage image)
    {
        // open existing JBIG2 file
        using (Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File jbig2File = 
            new Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(stream))
        {
            // add image to JBIG2 file
            jbig2File.Pages.Add(image);
    
            // save changes
            jbig2File.SaveChanges();
        }
    }
    
    Public Sub AddImageToJbig2UsingJbig2File(stream As System.IO.Stream, image As Vintasoft.Imaging.VintasoftImage)
        ' open existing JBIG2 file
        Using jbig2File As New Vintasoft.Imaging.Codecs.ImageFiles.Jbig2.Jbig2File(stream)
            ' add image to JBIG2 file
            jbig2File.Pages.Add(image)
    
            ' save changes
            jbig2File.SaveChanges()
        End Using
    End Sub
    


    Вот код C#/VB.NET-код, который демонстрирует, как добавить изображение в JBIG2 файл с помощью классов VintasoftImage и Jbig2Encoder:
    public void AddImageToJbig2UsingVintasoftImage(
        System.IO.Stream stream, 
        Vintasoft.Imaging.VintasoftImage image)
    {
        // add image to JBIG2 file
        Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder encoder = 
            new Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(false);
    
        // add image to JBIG2 file
        image.Save(stream, encoder);
    
        // free resources used by encoder
        encoder.Dispose();
    }
    
    Public Sub AddImageToJbig2UsingVintasoftImage(stream As System.IO.Stream, image As Vintasoft.Imaging.VintasoftImage)
        ' add image to JBIG2 file
        Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.Jbig2Encoder(False)
    
        ' add image to JBIG2 file
        image.Save(stream, encoder)
    
        ' free resources used by encoder
        encoder.Dispose()
    End Sub