VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging Namespace / VintasoftImage Class / SetImage Method / SetImage(Image,Boolean) Method
The System.Drawing.Image object.
Determines that System.Drawing.Image object must be disposed after use.
Example



In This Topic
    SetImage(Image,Boolean) Method
    In This Topic
    Sets the System.Drawing.Image object associated with this VintasoftImage object.
    Syntax
    'Declaration
     
    Public Overloads Sub SetImage( _
       ByVal bitmap As Image, _
       ByVal disposeBitmapAfterUse As Boolean _
    ) 
    public void SetImage( 
       Image bitmap,
       bool disposeBitmapAfterUse
    )
    public: void SetImage( 
       Image* bitmap,
       bool disposeBitmapAfterUse
    ) 
    public:
    void SetImage( 
       Image^ bitmap,
       bool disposeBitmapAfterUse
    ) 

    Parameters

    bitmap
    The System.Drawing.Image object.
    disposeBitmapAfterUse
    Determines that System.Drawing.Image object must be disposed after use.
    Exceptions
    ExceptionDescription
    Thrown if bitmap is null.
    Throw if IsImageDataLocked is set to true.
    Remarks
    Bitmap object must not be disposed during lifetime of this VintasoftImage object.
    Example
    This example 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(image.GetAsBitmap())
                
        ' process image in external image editor and place it back to the clipboard
        ' ...
                
        ' get image from the clipboard
        image.SetImage(New Vintasoft.Imaging.VintasoftImage(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(image.GetAsBitmap());
                
        // process image in external image editor and place it back to the clipboard
        // ...
                
        // get image from the clipboard
        image.SetImage(new Vintasoft.Imaging.VintasoftImage(
            System.Windows.Forms.Clipboard.GetImage(), true));
                
        // save image to the file
        image.Save(@"c:\processed-image.jpg");
    }
    Requirements

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

    See Also