VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000 Namespace / Jpeg2000File Class
Members Example



In This Topic
    Jpeg2000File Class
    In This Topic
    Provides low-level functions for manipulating JPEG2000 file.
    Object Model
    Jpeg2000File ClassJpeg2000Page ClassImageFileSource Class
    Syntax
    Example
    This example shows how to convert a JPEG2000 file to a TIFF file.
    ' Converts Jpeg2000 file to Tiff file.
    Public Shared Sub ConvertJpeg2000ToTiff(jpeg2000Filename As String, tiffFilename As String)
        Using stream As New System.IO.FileStream(jpeg2000Filename, System.IO.FileMode.Open, System.IO.FileAccess.Read)
            If Not Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000File.IsValidFormat(stream) Then
                Throw New System.ApplicationException()
            End If
                
            Dim image As Vintasoft.Imaging.VintasoftImage
                
            Using file As New Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000File(stream)
                image = file.Page.GetImage()
            End Using
                
            Dim tiffEncoder As New Vintasoft.Imaging.Codecs.Encoders.TiffEncoder()
                
            image.Save(tiffFilename, tiffEncoder)
                
            tiffEncoder.Dispose()
                
            image.Dispose()
        End Using
    End Sub
    // Converts Jpeg2000 file to Tiff file.
    public static void ConvertJpeg2000ToTiff(string jpeg2000Filename, string tiffFilename)
    {
        using (System.IO.FileStream stream = new System.IO.FileStream(
            jpeg2000Filename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
        {
            if (!Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000File.IsValidFormat(stream))
            {
                throw new System.ApplicationException();
            }
                
            Vintasoft.Imaging.VintasoftImage image;
                
            using (Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000File file =
                new Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000File(stream))
            {
                image = file.Page.GetImage();
            }
                
            Vintasoft.Imaging.Codecs.Encoders.TiffEncoder tiffEncoder =
                new Vintasoft.Imaging.Codecs.Encoders.TiffEncoder();
                
            image.Save(tiffFilename, tiffEncoder);
                
            tiffEncoder.Dispose();
                
            image.Dispose();
        }
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Codecs.ImageFiles.ImageFileBase<T>
          Vintasoft.Imaging.Codecs.ImageFiles.SinglePageImageFile<T>
             Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000File

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also