to converte a png I use FW_transformBitmap and then save with fw_saveImage
but it createa bmp with black background
I see the bitmap image with black outlines which makes the image look a little grainy and unclear
how can I change the background of the image?
transform Png to Bmp
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
transform Png to Bmp
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: transform Png to Bmp
I try to save the file to Jpg and then to Bmp and now seem run ok
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: transform Png to Bmp
Where is the function FW_transformBitmap() ?
I would do it this way:
FW_SaveImage( "name.png", "name.bmp" )
Did you try this? How is the quality?
I would do it this way:
FW_SaveImage( "name.png", "name.bmp" )
Did you try this? How is the quality?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: transform Png to Bmp
Rao,
FW_transformBitmap is in http://forums.fivetechsupport.com/viewt ... formBitmap
I used this because I wanted have a small image but
my test code to save from png to Bmp
Before I save from Png to Bmp but it saved with black outlines and before it was no good for me
bow I converte before to Jpg and then to Bmp
FW_transformBitmap is in http://forums.fivetechsupport.com/viewt ... formBitmap
I used this because I wanted have a small image but
my test code to save from png to Bmp
Code: Select all
Local aElementi:=CaricaElementi()
Local cFoldertemp:=".\bitmaps\mini\temp\"
Local aElementiBmp:= {}
Local cFileBmp_Elementi:= "TempEl_"
aElementiBmp:= CreaMiniatureElementi(aElementi,cFoldertemp,cFileBmp_Elementi)
//-----------------------------------------------------------------------------------------//
Function CreaMiniatureElementi(aElementi,cFoldertemp,cFileBmp_Elementi)
Local n
Local k
Local atempBmp := {}
Local cFile,cfileNew
For n= 1 to Len(aElementi)
// from Png to Jpg
cfile:= Converti_Immagine_Bmp(alltrim(aElementi [n][8]),;
cFolderTemp,;
cFileBmp_Elementi+alltrim(str(n)),0.80)
// from Jog to Bmp
cFileNew:= savetobmp(cfile)
//aadd(atempBmp ,cFolderTemp+cFileBmp_Elementi+alltrim(str(n))+".bmp")
aadd(atempBmp ,cFileNew+".bmp")
next
//xbrowser atempBmp
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 )
//hNew := FW_TransformBitmap( hBmp, {0.2,0.2,-0.2,-0.2}, 0.75, 45 )
//hNew := FW_TransformBitmap( hBmp, nil, 0.75, 45 )
ext:= aExt[ntipo]
//FW_SaveImage( [uImage], [cFile], [nJpgQuality] )
// FW_SaveImage( hNew, cFolderTemp+cNewName+ext,40 )
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
Before I save from Png to Bmp but it saved with black outlines and before it was no good for me
bow I converte before to Jpg and then to Bmp
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: transform Png to Bmp
Now I try with your commandnageswaragunupudi wrote:Where is the function FW_transformBitmap() ?
I would do it this way:
FW_SaveImage( "name.png", "name.bmp" )
Did you try this? How is the quality?
Code: Select all
aElementiBmp:= ConvertImage(aElementi,cFoldertemp,cFileBmp_Elementi)
Function ConvertImage(aElementi,cFoldertemp,cFileBmp_Elementi)
Local atempBmp := {}
Local n
For n= 1 to Len(aElementi)
FW_SaveImage( alltrim(aElementi [n][8]), cFolderTemp+cFileBmp_Elementi+alltrim(str(n))+".bmp" )
aadd(atempBmp ,cFolderTemp+cFileBmp_Elementi+alltrim(str(n))+".bmp")
next
return atempBmp
and you can see the Image with Black outlines , the quality is no good
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: transform Png to Bmp
May I know why do you want to convert them as bmp?
Can you not use the png directly in your application?
Can you not use the png directly in your application?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: transform Png to Bmp
Be
But I found a solution ( Png->Jpg->Bmp)
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)
Because I wish use a Combobox and the Combobox not support Png as You told me and I must use Pngsnageswaragunupudi wrote:May I know why do you want to convert them as bmp?
Can you not use the png directly in your application?
But I found a solution ( Png->Jpg->Bmp)
Code: Select all
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
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
//---------------------------------------------------------------------------------------------//
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC