Be
nageswaragunupudi wrote:May I know why do you want to convert them as bmp?
Can you not use the png directly in your application?
Because I wish use a Combobox and the Combobox not support Png as You told me and I must use Pngs
But I found a solution ( Png->Jpg->Bmp)
- Code: Select all Expand view RUN
Function CreaMiniatureElementi(aElementi,cFoldertemp,cFileBmp_Elementi)
Local n
Local k
Local atempBmp := {}
Local cFile,cfileNew
For n= 1 to Len(aElementi)
cfile:= Converti_Immagine_Bmp(alltrim(aElementi [n][8]),;
cFolderTemp,;
cFileBmp_Elementi+alltrim(str(n)),0.80)
cFileNew:= savetobmp(cfile)
aadd(atempBmp ,cFileNew+".bmp")
next
return atempBmp
Function Converti_Immagine_Bmp(cFile,cFolderTemp,cNewName,nResize,ntipo)
Local aext :={".Bmp",".Jpg"}
Local hBmp
Local hNew
DEFAULT ntipo:= 2
DEFAULT nResize:=0.30
ext:= aExt[ntipo]
FW_SaveImage( cFile, cFolderTemp+cNewName+ext,40 )
Return cFolderTemp+cNewName+ext
//------------------------------------------------------------------------//
Function savetobmp(cfile)
Local hBmp := FW_ReadImage( nil, cfile )[ 1 ]
FW_SaveImage( hBmp, cfile+".Bmp",40 )
Return cfile
I must resize it on first passage Local aElementi:=CaricaElementi()
Local cFoldertemp:=".\bitmaps\mini\temp\"
Local aElementiBmp:= {}
Local cFileBmp_Elementi:= "TempEl_"
aElementiBmp:= CreaMiniatureElementi(aElementi,cFoldertemp,cFileBmp_Elementi)
- Code: Select all Expand view RUN
Function CreaMiniatureElementi(aElementi,cFoldertemp,cFileBmp_Elementi)
Local n
Local k
Local atempBmp := {}
Local cFile,cfileNew
For n= 1 to Len(aElementi)
//toJpg and resize
cfile:= Converti_Immagine_Bmp(alltrim(aElementi [n][8]),;
cFolderTemp,;
cFileBmp_Elementi+alltrim(str(n)),0.80)
// save to Bmp
cFileNew:= savetobmp(cfile)
aadd(atempBmp ,cFileNew+".bmp")
next
return atempBmp
//-------------------------------------------------------------------------------------------------------------//
Function Converti_Immagine_Bmp(cFile,cFolderTemp,cNewName,nResize,ntipo)
Local aext :={".Bmp",".Jpg"}
Local hBmp
Local hNew
DEFAULT ntipo:= 2
DEFAULT nResize:=0.30
hBmp := FW_ReadImage( nil, cFile )[ 1 ]
hNew := FW_TransformBitmap( hBmp, NIL, nResize )
ext:= aExt[ntipo]
//FW_SaveImage( [uImage], [cFile], [nJpgQuality] )
FW_SaveImage( hNew, cFolderTemp+cNewName+ext,40 )
Return cFolderTemp+cNewName+ext
//-------------------------------------------------------------------------------------------//
Function savetobmp(cfile)
Local hBmp := FW_ReadImage( nil, cfile )[ 1 ]
FW_SaveImage( hBmp, cfile+".Bmp",40 )
Return cfile
//---------------------------------------------------------------------------------------------//
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com