Page 1 of 1
Bos Taurus BT_BitmapSaveFile
Posted: Wed Sep 28, 2022 5:07 pm
by Georg_BA
Hello everyone.
I need help with a function from Bos Taurus.
If I open a PNG file
hBitmap := BT_BitmapLoadFile (cLocalTempFile) and have it saved as a JPG
BT_BitmapSaveFile (hBitmap, cLocalTempFile, BT_FILEFORMAT_JPG)
it changes my background color to black.
It is possible to set or change it somewhere
Re: Bos Taurus BT_BitmapSaveFile
Posted: Wed Sep 28, 2022 6:59 pm
by Georg_BA
I am attaching the files for the test
Re: Bos Taurus BT_BitmapSaveFile
Posted: Thu Sep 29, 2022 8:35 am
by vagblad
Hi Georg,
The background turns to black because the png file contains a transparency layer which you cannot transfer to the .jpg format. Try this sample code if you please:
Code: Select all
Local hBitmap := NIL
Local hBitmap2 := NIL
hBitmap := BT_BitmapLoadFile("62451.png")
hbitmap2 := BT_BitmapCreateNew (BT_BitmapWidth (hBitmap), BT_BitmapHeight (hBitmap), {255,255,255})
BT_BitmapPasteTransparent (hBitmap2, 0, 0, , , BT_COPY, hBitmap, )
BT_BitmapSaveFile (hBitmap2, "new.jpg", BT_FILEFORMAT_JPG)
I hope it helps!
Re: Bos Taurus BT_BitmapSaveFile
Posted: Thu Sep 29, 2022 11:20 am
by Georg_BA
Thanks for the help, but the result is the same
Re: Bos Taurus BT_BitmapSaveFile
Posted: Thu Sep 29, 2022 12:36 pm
by gfilatov
Georg_BA wrote: ↑Thu Sep 29, 2022 11:20 am
Thanks for the help, but the result is the same
Hi Georg,
The suggested code for conversion your PNG file is correct.
Please take a look at the attached JPG result file with white background after conversion.

Re: Bos Taurus BT_BitmapSaveFile
Posted: Thu Sep 29, 2022 8:48 pm
by Georg_BA
Vagelis & Grigory
Thanks for help
I went through it again, and the fault was between the chair and the computer.
Everything works correctly there is a white background
Sincerely Georg
Re: Bos Taurus BT_BitmapSaveFile
Posted: Fri Sep 30, 2022 8:05 am
by vagblad
Georg_BA wrote: ↑Thu Sep 29, 2022 8:48 pm
Vagelis & Grigory
Thanks for help
I went through it again, and the fault was between the chair and the computer.
Everything works correctly there is a white background
Sincerely Georg
Great!i am glad it works. And once again a big thank you to Dr. Soto for the amazing BT library
Re: Bos Taurus BT_BitmapSaveFile
Posted: Sun Oct 02, 2022 2:13 pm
by Rathinagiri