VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging Namespace / VintasoftImageGdiExtensions Class / SetImage(VintasoftImage,Image,Boolean) Method
Syntax Exceptions Remarks Example Requirements SeeAlso
In This Topic
SetImage(VintasoftImage,Image,Boolean) Method (VintasoftImageGdiExtensions)
In This Topic
Sets the System.Drawing.Image object associated with this VintasoftImage object.
Syntax
'Declaration

<ExtensionAttribute()>
Public Shared Sub SetImage( _
ByVal image
The image.
As VintasoftImage, _
ByVal bitmap As System.Drawing.Image, _
ByVal disposeBitmapAfterUse
A value indicating whether System.Drawing.Image object must be disposed after use.
As Boolean _
)

Parameters

image
The image.
bitmap
The System.Drawing.Image object.
disposeBitmapAfterUse
A value indicating whether System.Drawing.Image object must be disposed after use.
Exceptions
ExceptionDescription
Thrown if bitmap is null.
Thrown if IsImageDataLocked is set to true.
Remarks

Bitmap object must not be disposed during lifetime of this VintasoftImage object.

Example

This C#/VB.NET code shows how to load image from disk, copy image to clipboard, process image in external image editor, copy image back from the clipboard and save processed image.


' load image from file
Using image As New Vintasoft.Imaging.VintasoftImage("c:\original-image.tif")
    ' copy image to clipboard
    System.Windows.Forms.Clipboard.SetImage(Vintasoft.Imaging.VintasoftImageGdiExtensions.GetAsBitmap(image))

    ' process image in external image editor and place it back to the clipboard
    ' ...

    ' get image from the clipboard
    image.SetImage(Vintasoft.Imaging.VintasoftImageGdiExtensions.Create(System.Windows.Forms.Clipboard.GetImage(), True))

    ' save image to the file
    image.Save("c:\processed-image.jpg")
End Using


// load image from file
using (Vintasoft.Imaging.VintasoftImage image =
    new Vintasoft.Imaging.VintasoftImage(@"c:\original-image.tif"))
{
    // copy image to clipboard
    System.Windows.Forms.Clipboard.SetImage(Vintasoft.Imaging.VintasoftImageGdiExtensions.GetAsBitmap(image));

    // process image in external image editor and place it back to the clipboard
    // ...

    // get image from the clipboard
    image.SetImage(Vintasoft.Imaging.VintasoftImageGdiExtensions.Create(
        System.Windows.Forms.Clipboard.GetImage(), true));

    // save image to the file
    image.Save(@"c:\processed-image.jpg");
}

Requirements

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

See Also