GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / ReleaseGdPictureImage Method
The unique image identifier of the image resource to be released.
Example





In This Topic
ReleaseGdPictureImage Method (GdViewer)
In This Topic
Releases a specified image and its corresponding image resource from memory.
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
The unique image identifier of the image resource to be released.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
Remarks
It is always a best practice to release images you have created once you have no use for them.
Example
How to save the current page of the displayed document as a thumbnail in the PNG format.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
    Dim imageID As Integer = GdViewer1.GetPageThumbnail(256, 256, GdViewer1.CurrentPage, GdViewer1.ARGB(255, 180, 180, 180))
    If GdViewer1.GetStat() = GdPictureStatus.OK Then
        Using oGdPictureImaging As GdPictureImaging = New GdPictureImaging()
            If oGdPictureImaging.SaveAsPNG(imageID, "thumbnail.png") = GdPictureStatus.OK Then
                MessageBox.Show("The created thumbnail has been saved successfully.", "GdViewer.ReleaseGdPictureImage")
            Else
                MessageBox.Show("The created thumbnail can't be saved. Status: " + oGdPictureImaging.GetStat().ToString(), "GdViewer.ReleaseGdPictureImage")
            End If
        End Using
        GdViewer1.ReleaseGdPictureImage(imageID)
    Else
        MessageBox.Show("The thumbnail can't be created. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ReleaseGdPictureImage")
    End If
Else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ReleaseGdPictureImage")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
    int imageID = GdViewer1.GetPageThumbnail(256, 256, GdViewer1.CurrentPage, GdViewer1.ARGB(255, 180, 180, 180));
    if (GdViewer1.GetStat() == GdPictureStatus.OK)
    {
        using (GdPictureImaging oGdPictureImaging = new GdPictureImaging())
        {
            if (oGdPictureImaging.SaveAsPNG(imageID, "thumbnail.png") == GdPictureStatus.OK)
                MessageBox.Show("The created thumbnail has been saved successfully.", "GdViewer.ReleaseGdPictureImage");
            else
                MessageBox.Show("The created thumbnail can't be saved. Status: " + oGdPictureImaging.GetStat().ToString(), "GdViewer.ReleaseGdPictureImage");
        }
        GdViewer1.ReleaseGdPictureImage(imageID);
    }
    else
        MessageBox.Show("The thumbnail can't be created. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ReleaseGdPictureImage");
}
else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ReleaseGdPictureImage");
See Also