Carlos,
thank You very much for the info.
I cannot post a screenshot before monday, because of server-changes.
The problem, I have to keep the aspect ratio
width and height.
It means I want to resize with a
zoom-factor ( % ) or
a given
width with the height calculated
or a given
height with the width calculated.
FIMAKETHUMBNAIL( cSrcFile, cDstFile,
nPixel )
width and height will be the same.
GOT IT WORKING !!!
Saved a image resized keeping the aspect ratio.
works with %, a given width or a given height
// STATIC oDrawImg, nExpResize, nExpWidth, nExpHeight, cExtension
STATIC FUNCTION SAVE_EXP()
LOCAL oExpImage, hResizeImg, cFilename, lResize := .F., nFactor := 1
LOCAL nIWidth := oDrawImg:nWidth
LOCAL nIHeight := oDrawImg:nHeight
LOCAL nWFactor := nExpWidth / nIWidth
LOCAL nHFactor := nExpHeight / nIHeight
nFilecount++ // filecounter
cFilename := cExppath + ALLTRIM(cDestFile) + ;
ALLTRIM(STR(nFileCount)) + "." + cExtension
DEFINE IMAGE oExpImage FILENAME cFilename
IF nExpResize <> 0 // given %
nFactor := nExpResize / 100
nIWidth := oDrawImg:nWidth * nFactor
nIHeight := oDrawImg:nHeight * nFactor
lResize := .T.
ELSEIF nExpWidth > 0 // defined width ( height calculated )
nIWidth := nExpWidth
nIHeight := oDrawImg:nHeight * nWFactor
lResize := .T.
ELSEIF nExpHeight > 0 // defined height ( width calculated )
nIWidth := oDrawImg:nWidth * nHFactor
nIHeight := nExpHeight
lResize := .T.
ENDIF
IF lResize = .F.
MsgAlert( "NO resize-factor defined !" +CRLF + ;
"original size is used ", "Resize-factor" )
ENDIF
hResizeImg := ResizeImg( oDrawImg:hBitmap, nIWidth, nIHeight )
oExpImage:hBitmap := hResizeImg
oExpImage:SaveImage( cFilename, nExport )
oExpImage:End()
RETURN NIL
Best regards
Uwe
