GdPicture.NET Reference Guide
ReleaseGdPictureImage Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : ReleaseGdPictureImage Method
A unique image identifier of the GdPictureImage object representing the image to release.
Releases the specified GdPictureImage object represented by its unique image identifier from memory. Please note, that the toolkit does not release created image objects automatically, so releasing images after they have been used is mandatory.
Syntax
'Declaration
 
Public Function ReleaseGdPictureImage( _
   ByVal ImageID As Integer _
) As GdPictureStatus
public GdPictureStatus ReleaseGdPictureImage( 
   int ImageID
)
public function ReleaseGdPictureImage( 
    ImageID: Integer
): GdPictureStatus; 
public function ReleaseGdPictureImage( 
   ImageID : int
) : GdPictureStatus;
public: GdPictureStatus ReleaseGdPictureImage( 
   int ImageID
) 
public:
GdPictureStatus ReleaseGdPictureImage( 
   int ImageID
) 

Parameters

ImageID
A unique image identifier of the GdPictureImage object representing the image to release.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
Remarks
It is always a best practice to release images you have created once you have no use for them. Be aware, that releasing image objects is mandatory, the toolkit does not release them automatically in any way.
Example
How to properly release an image object from memory after it has been used.
Dim caption As String = "Example: ReleaseGdPictureImage"
Using oImage As GdPictureImaging = New GdPictureImaging()
    'Creating a GdPicture Image object from a required image file.
    Dim imageID As Integer = oImage.CreateGdPictureImageFromFile("input.png")
    If oImage.GetStat() = GdPictureStatus.OK Then
        'Processing the created image.
        If oImage.FxAqua(imageID) = GdPictureStatus.OK Then
            If oImage.SaveAsPNG(imageID, "output.png") = GdPictureStatus.OK Then
                MessageBox.Show("The image has been saved successfully.", caption)
            Else
                MessageBox.Show("The image can't be saved. Status: " + oImage.GetStat().ToString(), caption)
            End If
        Else
            MessageBox.Show("The FxAqua() method has failed with the status: " + oImage.GetStat().ToString(), caption)
        End If
        'Releasing the image resource after it has been used.
        oImage.ReleaseGdPictureImage(imageID)
    Else
        MessageBox.Show("The image can't be created. Status: " + oImage.GetStat().ToString(), caption)
    End If
End Using
string caption = "Example: ReleaseGdPictureImage";
using (GdPictureImaging oImage = new GdPictureImaging())
{
    //Creating a GdPicture Image object from a required image file.
    int imageID = oImage.CreateGdPictureImageFromFile("input.png");
    if (oImage.GetStat() == GdPictureStatus.OK)
    {
        //Processing the created image.
        if (oImage.FxAqua(imageID) == GdPictureStatus.OK)
        {
            if (oImage.SaveAsPNG(imageID, "output.png") == GdPictureStatus.OK)
                MessageBox.Show("The image has been saved successfully.", caption);
            else
                MessageBox.Show("The image can't be saved. Status: " + oImage.GetStat().ToString(), caption);
        }
        else
            MessageBox.Show("The FxAqua() method has failed with the status: " + oImage.GetStat().ToString(), caption);
        //Releasing the image resource after it has been used.
        oImage.ReleaseGdPictureImage(imageID);
    }
    else
        MessageBox.Show("The image can't be created. Status: " + oImage.GetStat().ToString(), caption);
}
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
CreateGdPictureImageFromFile(String) Method
CreateNewGdPictureImage(Int32,Int32,PixelFormat,Color) Method
CreateClonedGdPictureImage Method