ReleaseGdPictureImage Method (GdViewer)
In This Topic
Releases a specified image and its corresponding image resource from memory.
Syntax
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.
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");
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