ImageEn, unit iexHelperFunctions

IECreateThumbnailFromFile


Declaration

function IECreateThumbnailFromFile(const sInFilename: string;
                                   const sOutFilename: string;
                                   MaxX, MaxY: integer;
                                   StretchSmall: Boolean;
                                   JpegQuality: integer;
                                   AutoAdjustOrientation: Boolean = False;
                                   QualityFilter : TResampleFilter = rfLanczos3;
                                   // Border Params
                                   bAddBorder: Boolean = False;
                                   cBorderColor: TColor = clBlack;
                                   // Shadow Params
                                   bAddShadow: Boolean = False;
                                   iBlurRadius : Integer = 4;
                                   iShadowOffset : Integer = 4;
                                   cShadowColor: TColor = clBlack;
                                   // Background Params
                                   cBGColor: TColor = clWhite
                                   ): Boolean;


Description

Creates a thumbnail from an image.

Parameter Description
sInFilename The image to load
sOutFilename The filename of the saved thumbnail
MaxX, MaxY The maximum size of the new image (as the aspect ratio is maintained, one of the dimensions is likely to be less than the specified value)
StretchSmall Set to false to avoid images smaller than MaxX x MaxY from being made larger
AutoAdjustOrientation Sets EnableAdjustOrientation to automatically re-orient JPEG camera images
QualityFilter Specify the quality that is used for rescaling the image
bAddBorder Set to true to add a 1 pixel border to the thumbnail
cBorderColor The color of the added border
bAddShadow Add a solid or soft shadow to the image
iBlurRadius Set to 0 to add a solid shadow or any other value for the width of the Soft Shadow
iShadowOffset The offset of the shadow from the image
cShadowColor The shadow color
cBGColor The color of the image behind the shadow

Note: You must add the iexHelperFunctions unit to your uses clause


Examples

// Create a thumbnail of MyImage.jpeg at size 160x120 and save to MyImage_Thumb.jpeg
IECreateThumbnailFromFile('D:\MyImage.jpeg', 'D:\MyImage_Thumb.jpeg', 160, 120, False, 75)

// Load an image as 250x250 thumbnail with a shadow
IECreateThumbnailFromFile( 'D:\MyImage.jpg',         // sInFilename
                           'D:\MyImage_Thumb.jpg'    // sOutFilename
                            250, 250,                // MaxX, MaxY
                            True,                    // StretchSmall
                            True,                    // AutoAdjustOrientation
                            rfLanczos3,              // QualityFilter
                            False,                   // bAddBorder
                            clBlack,                 // cBorderColor
                            TRUE,                    // bAddShadow
                            5,                       // iBlurRadius
                            1,                       // iShadowOffset
                            clBlack,                 // cShadowColor
                            clWhite );               // cBGColor