QPix Command Reference
![]() |
![]() ![]() |
QPxObs_GetImageFileThumbnail(imagePath; thumbPict; thumbWidth; thumbHeight; pixelDepth; fillColor):error | |||
![]() |
imagePath | Text | Full path name to the image file |
![]() |
thumbPict | Picture | The thumbnail picture |
![]() |
thumbWidth | Longint | Container rectangle width in pixels |
![]() |
thumbHeight | Longint | Container rectangle height in pixels |
![]() |
pixelDepth | Longint | The thumbnail's pixel depth |
![]() |
fillColor | Longint | The thumbnail's fill color |
![]() |
error | Longint | Error result |
This command is preserved in QPix v3 for backward compatibility reasons. In v3 it is substituted by QPx_CreateImageFileThumbnail which creates high-quality thumbnails.
Creates a thumbnail from an image file and stores it in a 4D picture.
The image file specified by imagePath. If imagePath is empty, QPix presents a file selection dialog where the user can preview and select an image file. If the user selects a file, its full pathname is returned in imagePath, otherwise error qpx_userCancelErr is returned.
The thumbnail is returned in the thumbPict picture variable. Thumbnail dimensions are specified by thumbWidth and thumbHeight. These need not be proportional to the original image dimensions; QPix will automatically scale down the image proportionally and center it inside the designated container rectangle. This command cannot be used for scaling images up.
Thumbnail pixel depth is specified in the pixelDepth parameter. The pixelDepth parameter must be in range of 0..40 (values greater than 32 mean grayscale). If omitted or equal to 0, QPix will use the original pixel depth instead.
The color used to fill the areas of the thumbnail that will remain uncovered is specified in the fillColor parameter. If omitted or set to 0, QPix will use the black color. Fill color should be specified in the same way as in 4D's SET RGB COLOR command: 0x00RRGGBB.
Alternatively to RGB you can use 4D's automatic colors; also, you can get the "tight" thumbnail of an image by passing QPix's qpx_NoFill constant that is explained below. Please see thumb options for the full list of all available constants and corresponding values."Tight" thumbnails
If you specify the value -256 (or the constant qpx_NoFill) in the fillColor parameter, QPix will function somewhat differently: instead of producing a thumbnail that fits exactly the designated size and fill the uncovered area with the designated fill color, it will produce a thumbnail that will contain only the useful part of the image. This is what we call a "tight" thumbnail.
Tight thumbnails normally occupy less bytes than color-filled ones. Also, their actual width and height is not identical to the width and height of the requested container rectangle. To get the actual dimensions of a tight thumbnail, use QPx_GetPictureInfo.
Example
`Create a 80x80, 256 color thumbnail `Fill uncovered area with the default background color C_LONGINT($error) C_TEXT($imagePath) C_PICTURE($pict) $imagePath:="Hard disk:images:people.gif" $error:=QPx_GetImageFileThumbnail ($imagePath;$pict; 80; 80; 8;Default background color) If ($error#qpx_noErr) `Handle the error End if |