Bos Taurus BT_BitmapSaveFile

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
Georg_BA
Posts: 108
Joined: Fri Apr 07, 2017 5:31 pm
DBs Used: DBF

Bos Taurus BT_BitmapSaveFile

Post 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
Attachments
40319.jpg
40319.jpg (39 KiB) Viewed 5410 times
Georg_BA
Posts: 108
Joined: Fri Apr 07, 2017 5:31 pm
DBs Used: DBF

Re: Bos Taurus BT_BitmapSaveFile

Post by Georg_BA »

I am attaching the files for the test
Attachments
pfoto.zip
(214.23 KiB) Downloaded 129 times
User avatar
vagblad
Posts: 174
Joined: Tue Jun 18, 2013 12:18 pm
DBs Used: MySQL,DBF
Location: Thessaloniki, Greece

Re: Bos Taurus BT_BitmapSaveFile

Post 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!
Vagelis Prodromidis
Email: vagblad@gmail.com, Skype: vagblad
Georg_BA
Posts: 108
Joined: Fri Apr 07, 2017 5:31 pm
DBs Used: DBF

Re: Bos Taurus BT_BitmapSaveFile

Post by Georg_BA »

Thanks for the help, but the result is the same
Attachments
Screenshot_1.png
Screenshot_1.png (492.08 KiB) Viewed 5316 times
User avatar
gfilatov
Posts: 1116
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Bos Taurus BT_BitmapSaveFile

Post 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. :arrow:
Attachments
new.zip
(30.2 KiB) Downloaded 144 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Georg_BA
Posts: 108
Joined: Fri Apr 07, 2017 5:31 pm
DBs Used: DBF

Re: Bos Taurus BT_BitmapSaveFile

Post by Georg_BA »

Vagelis & Grigory

Thanks for help

I went through it again, and the fault was between the chair and the computer. :oops:

Everything works correctly there is a white background

Sincerely Georg
User avatar
vagblad
Posts: 174
Joined: Tue Jun 18, 2013 12:18 pm
DBs Used: MySQL,DBF
Location: Thessaloniki, Greece

Re: Bos Taurus BT_BitmapSaveFile

Post 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. :oops:

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
Vagelis Prodromidis
Email: vagblad@gmail.com, Skype: vagblad
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Bos Taurus BT_BitmapSaveFile

Post by Rathinagiri »

Georg_BA wrote: Thu Sep 29, 2022 8:48 pm the fault was between the chair and the computer. :oops:
:o :D
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply