I think you make a sample test (fwh 18.03)
viewtopic.php?f=3&t=35547&start=0&hilit=FW_transformBitmap#p211638
local nJpgQuality := 90
FW_SaveImage( cFile, cFolderTemp+cNewName+ext,nJpgQuality )
and now run ok
Can you please
1) Let me know why do you want to convert png to jpg with reduced size? Can you not directly use png?
2) Can you send me your png by email? Like to some tests and see.
aBmp: = FW_ReadImage( nil, cFile )
hNew: = FW_TransformBitmap( aBmp[ 1 ], NIL, 0.30 )
FW_SaveHBitmap( hNew, "new.bmp" )
PalBmpFree( aBmp )
DeleteObject( hNew )
cDir:= "temp\"
IF !lIsDir( lower(cDir) )
IF lMkDir( lower( cDir) )
ELSE
MsgAlert("Err "+cdir,"Verificare!")
ENDIF
ENDIF
USE ELEMENTI ALIAS EL
aElementi:= CaricaElementi(.t.) // load array
aBmpCombo:= Crea_BMP(aElementi,cFoldertemp,cFileBmp_Elementi) // create Bmps for combobox
//-----------------------------------------------------------------------------//
Function Crea_Bmp(aElementi,cFolderTemp,cFileBmp_Elementi)
Local n
Local k
Local atempBmp := {}
Local cFile,cfileNew
Local cCartella := cFoldertemp+"\"
For n= 1 to Len(aElementi)
cfile:= Conversione(alltrim(aElementi [n][5]),cCartella ,cFileBmp_Elementi+alltrim(str(n)))
aadd(atempBmp ,cFile+".bmp")
next
return atempBmp
//-----------------------------------------------------------------------------//
Function Conversione(cFile,Cfolder,cNewFile)
Local aBmp := FW_ReadImage( nil, cFile )
Local hNew := FW_TransformBitmap( aBmp[ 1 ], NIL, 0.30 )
FW_SaveHBitmap( hNew, cFolder+cNewFile+".bmp" )
PalBmpFree( aBmp )
DeleteObject( hNew )
return cNewFile
Function Crea_Bmp(aElementi,cFolderTemp,cFileBmp_Elementi)
Local n
Local k
Local atempBmp := {}
Local cFile,cfileNew
Local cCartella := cFoldertemp+"\"
For n= 1 to Len(aElementi)
// to JPG +RESIZE
cfile:= Conversione(alltrim(aElementi [n][5]),;
cCartella ,;
cFileBmp_Elementi+alltrim(str(n)))
// to BMP
cFileN := savetobmp(cfile)
DELETEFILE(cFILE)
aadd(atempBmp ,cFileN+".bmp")
next
return atempBmp
Function Conversione(cFile,Cfolder,cNewFile)
Local aBmp := FW_ReadImage( nil, cFile )
Local hNew := FW_TransformBitmap( aBmp[ 1 ], NIL, 0.30 )
//FW_SaveHBitmap( hNew, cFolder+cNewFile+".jpg",90 )
FW_SaveImage( hNew, cFolder+cNewFile+".jpg",90 ) // to JPG
PalBmpFree( aBmp )
DeleteObject( hNew )
return cFolder+cNewFile+".jpg"
Function Savetobmp(cfile)
Local aBmp := FW_ReadImage( nil, cfile )[ 1 ]
FW_SaveImage( aBmp, cfile+".Bmp",40 )
Return cfile
nageswaragunupudi wrote:For bitmaps FW_SaveHBitmap() saves with better quality than FW_SaveImage()
What you saw as black color is in fact Alpha color and FWH controls correctly paint the bitmaps treating the alpha color as transparent
Note: After some more tests, we will improve FW_SaveImage() in the next version.
For n= 1 to Len(aElementi)
cFileBmp:= Nages_BMP(alltrim(aElementi [n][5]),;
cCartella ,;
cFileBmp_Elementi+alltrim(str(n)))
aadd(atempBmp ,cFileBmp)
next
return atempBmp
Function Nages_BMP(cFile,cFolder,cNewFile)
Local aBmp:= FW_ReadImage( nil, cFile )
Local hNew:= FW_TransformBitmap( aBmp[ 1 ], NIL, 0.30 )
Local cnew := cFolder+cNewFile+".bmp"
FW_SaveHBitmap( hNew,cnew )
PalBmpFree( aBmp )
DeleteObject( hNew )
return cnew
nageswaragunupudi wrote:I am seeing. The reason is that combobox is not painting alphabmps properly.
Need to improve this aspect. Takes time.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 36 guests