using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg");
int thumbnailID = 0;
if (gdpictureImaging.HasAttachedThumbnail(imageID))
{
// Get the already attached thumbnail and save it as an image, then detach it.
thumbnailID = gdpictureImaging.GetAttachedThumbnail(imageID);
gdpictureImaging.SaveAsJPEG(thumbnailID, "thumbnail.jpg", 75);
gdpictureImaging.DetachThumbnail(imageID);
gdpictureImaging.ReleaseGdPictureImage(thumbnailID);
}
// Create a new thumbnail with a system-defined size and attach it to an image.
thumbnailID = gdpictureImaging.CreateThumbnail(imageID, 0, 0);
gdpictureImaging.AttachThumbnail(imageID, thumbnailID);
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(thumbnailID);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}