transform Png to Bmp
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
transform Png to Bmp
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?
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?
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
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
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: transform Png to Bmp
I try to save the file to Jpg and then to Bmp and now seem run ok
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
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
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- 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: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: transform Png to Bmp
Rao,
FW_transformBitmap is in http://forums.fivetechsupport.com/viewtopic.php?f=3&t=35547&start=0&hilit=FW_transformBitmap
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/viewtopic.php?f=3&t=35547&start=0&hilit=FW_transformBitmap
I used this because I wanted have a small image but
my test code to save from png to Bmp
Code: Select all | Expand
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
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
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
- Silvio.Falconi
- Posts: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: transform Png to Bmp
nageswaragunupudi 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?
Now I try with your command
Code: Select all | Expand
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
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
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
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- 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: 7136
- Joined: Thu Oct 18, 2012 7:17 pm
- Been thanked: 1 time
Re: transform Png to Bmp
Be
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)

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)
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
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
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
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