VintaSoft Imaging .NET SDK 12.3: Documentation for .NET developer
Vintasoft.Imaging Namespace / VintasoftImage Class / ConvertToGray() Method
Syntax Remarks Example Requirements SeeAlso
In This Topic
    ConvertToGray() Method (VintasoftImage)
    In This Topic
    Converts this image to the gray image (8-bpp pixel format).
    Syntax
    'Declaration
    
    Public Sub ConvertToGray()
    
    
    public void ConvertToGray()
    
    
    public: void ConvertToGray()
    
    
    public:
    void ConvertToGray()
    Remarks

    This method works synchronously, use the ChangePixelFormatCommand if you need to convert image asynchronously with progress indicator.

    Example

    This C#/VB.NET code shows how to load image from disk, convert it to gray image and save to file.

    
    ' load image from file
    Using image As New Vintasoft.Imaging.VintasoftImage("c:\original-image.tif")
        ' convert image to gray image
        image.ConvertToGray()
        ' save processed image to file
        image.Save("c:\processed-image.tif")
    End Using
    
    
    
    // load image from file
    using (Vintasoft.Imaging.VintasoftImage image =
        new Vintasoft.Imaging.VintasoftImage(@"c:\original-image.tif"))
    {
        // convert image to gray image
        image.ConvertToGray();
        // save processed image to file
        image.Save(@"c:\processed-image.tif");
    }
    
    

    Requirements

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

    See Also