CreateThumbnailHQ(String,Int32,Int32,Int32) Method
In This Topic
Creates a High Quality thumbnail of custom size from a file. This method tries to extract the embedded thumbnail from file metadata, if it is available.
It is particularly recommended to use this method to generate thumbnail from RAW image file.
The thumbnail can be fitted within a rectangle of specific dimensions having a specific background color.
Syntax
'Declaration
Public Overloads Function CreateThumbnailHQ( _
ByVal As String, _
ByVal As Integer, _
ByVal As Integer, _
ByVal As Integer _
) As Integer
public int CreateThumbnailHQ(
string ,
int ,
int ,
int
)
public function CreateThumbnailHQ(
: String;
: Integer;
: Integer;
: Integer
): Integer;
public function CreateThumbnailHQ(
: String,
: int,
: int,
: int
) : int;
public: int CreateThumbnailHQ(
string* ,
int ,
int ,
int
)
public:
int CreateThumbnailHQ(
String^ ,
int ,
int ,
int
)
Parameters
- FilePath
- The path of the file to open. Can be an empty string. If empty, prompts the user to select a file. You can subsequently use the GetLastPath() method to retrieve the path of the selected file.
- Width
- The width of the thumbnail to create. Use 0 to keep the embedded thumbnail width, if available, otherwise uses the initial bitmap width.
- Height
- The height of the thumbnail to create. Use 0 to keep the embedded thumbnail height, if available, otherwise uses the initial bitmap height.
- BackColor
- A suitable color value can be obtained by using the ARGBI() method. The background color of the thumbnail if width and height parameters are provided.
Return Value
GdPicture image identifier. The thumbnail Image. The ReleaseGdPictureImage() method must be subsequently used to release the image from the memory.
Example
Generating a high quality custom size thumbnail from a selected image file with a background color.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// Create a thumbnail with a black background that is 100 pixels width and 200 pixels height.
// An empty string allows the control to prompt for selecting an input file.
int thumbnailID = gdpictureImaging.CreateThumbnailHQ("", 100, 200, gdpictureImaging.ARGBI(255, 0, 0, 0));
gdpictureImaging.SaveAsPNG(thumbnailID, "thumbnail.png");
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(thumbnailID);
}
Example
Generating a high quality custom size thumbnail from a selected image file with a background color.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// Create a thumbnail with a black background that is 100 pixels width and 200 pixels height.
// An empty string allows the control to prompt for selecting an input file.
int thumbnailID = gdpictureImaging.CreateThumbnailHQ("", 100, 200, gdpictureImaging.ARGBI(255, 0, 0, 0));
gdpictureImaging.SaveAsPNG(thumbnailID, "thumbnail.png");
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(thumbnailID);
}
See Also