VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Codecs.ImageFiles.Raw Namespace / Rw2Page Class
Members Object Syntax Remarks Example Hierarchy Requirements SeeAlso
In This Topic
    Rw2Page Class
    In This Topic
    Represents a page of Panasonic RW2-file.
    Object Model
    Resolution Palette ImageFileSource Rw2Page
    Syntax
    'Declaration
    
    Public NotInheritable Class Rw2Page
       Inherits RawImagePageBase
    
    
    public sealed class Rw2Page : RawImagePageBase
    
    
    public __gc __sealed class Rw2Page : public RawImagePageBase*
    
    
    public ref class Rw2Page sealed : public RawImagePageBase^
    
    
    Remarks

    SDK uses LibRaw library for parsing RW2-file - please specify path to a LibRaw library using the LibRawPath property.

    Example

    Here is an example that shows how to open Panasonic RW2-file, get RAW-image from RW2-file and save image to a PNG-file:

    
    ''' <summary>
    ''' Opens Panasonic RW2-file, gets RAW-image from RW2-file and saves image to a PNG-file.
    ''' </summary>
    ''' <param name="rw2Filename">The name of RW2-file.</param>
    Public Sub GetAndSaveRw2RawImage(rw2Filename As String)
        ' set path to the "libraw.dll" file - VintaSoft Imaging .NET SDK uses LibRaw for parsing Panasonic RW2-file
        Vintasoft.Imaging.RawCodec.LibRawHelper.LibRawPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "libraw.dll")
    
        ' open RW2-file stream
        Using fs As New System.IO.FileStream(rw2Filename, System.IO.FileMode.Open, System.IO.FileAccess.Read)
            ' open RW2-file
            Dim rawImageFile As New Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImageFile(fs)
            ' get RW2-page
            Dim rw2Page As Vintasoft.Imaging.Codecs.ImageFiles.Raw.Rw2Page = TryCast(rawImageFile.Page, Vintasoft.Imaging.Codecs.ImageFiles.Raw.Rw2Page)
            ' if RW2-page is found in RAW-file
            If rw2Page IsNot Nothing Then
                ' get RAW-image as 48-bpp RGB image
                Using rawImage As Vintasoft.Imaging.VintasoftImage = rw2Page.GetImage()
                    ' save 48-bpp RGB image to a PNG file
                    rawImage.Save(rw2Filename & ".png")
                End Using
            End If
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Opens Panasonic RW2-file, gets RAW-image from RW2-file and saves image to a PNG-file.
    /// </summary>
    /// <param name="rw2Filename">The name of RW2-file.</param>
    public void GetAndSaveRw2RawImage(string rw2Filename)
    {
        // set path to the "libraw.dll" file - VintaSoft Imaging .NET SDK uses LibRaw for parsing Panasonic RW2-file
        Vintasoft.Imaging.RawCodec.LibRawHelper.LibRawPath =
            System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "libraw.dll");
    
        // open RW2-file stream
        using (System.IO.FileStream fs = new System.IO.FileStream(rw2Filename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
        {
            // open RW2-file
            Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImageFile rawImageFile =
                new Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImageFile(fs);
            // get RW2-page
            Vintasoft.Imaging.Codecs.ImageFiles.Raw.Rw2Page rw2Page =
                rawImageFile.Page as Vintasoft.Imaging.Codecs.ImageFiles.Raw.Rw2Page;
            // if RW2-page is found in RAW-file
            if (rw2Page != null)
            {
                // get RAW-image as 48-bpp RGB image
                using (Vintasoft.Imaging.VintasoftImage rawImage = rw2Page.GetImage())
                {
                    // save 48-bpp RGB image to a PNG file
                    rawImage.Save(rw2Filename + ".png");
                }
            }
        }
    }
    
    

    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Codecs.ImageFiles.ImageFileBlock
          Vintasoft.Imaging.Codecs.ImageFiles.ImagePage
             Vintasoft.Imaging.Codecs.ImageFiles.Raw.RawImagePageBase
                Vintasoft.Imaging.Codecs.ImageFiles.Raw.Rw2Page

    Requirements

    Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also