VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Codecs.ImageFiles.Raw Namespace / Cr3Page Class
    Класс Cr3Page
    В этом разделе
    Представляет страницу CR3-файла (Canon).
    Объектная модель
    Resolution Palette ImageFileSource Cr3Page
    Синтаксис
    'Declaration
    
    Public NotInheritable Class Cr3Page
       Inherits RawImagePageBase
    
    
    public sealed class Cr3Page : RawImagePageBase
    
    
    public __gc __sealed class Cr3Page : public RawImagePageBase*
    
    
    public ref class Cr3Page sealed : public RawImagePageBase^
    
    
    Ремарки

    SDK использует библиотеку LibRaw для анализа CR3-файла - укажите путь к библиотеке LibRaw с помощью свойства LibRawPath.

    Пример

    Вот пример, показывающий, как открыть CR3-файл, получить RAW-изображение из CR3-файла и сохранить изображение в PNG-файл:

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

    Иерархия наследования

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

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также