Convert a handle to the bitmap image to byte array or string.

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
edk
Posts: 503
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 137 times
Been thanked: 412 times

Convert a handle to the bitmap image to byte array or string.

Post by edk » Wed Sep 11, 2019 8:41 pm

Dear friends.

I need to do mass image conversion: scale to required size, possibly replace landscape / portrait format, convert image in JPG format to Base64.

I can do it in the following steps:
1. I read the file of image: BT_BitmapLoadFile ()
2. I scale the image: BT_BitmapCopyAndResize ()
3. Optionally, I change the orientation: BT_BitmapTransform ()
4. I save the temporary image to disk in JPG format: BT_BitmapSaveFile ()
5. I read the contents of the temporary file saved in step 4: FileStr ()
6. I convert a string of image's content to Base64
7. I delete the temporary file created in step 4.

I would like to skip steps 4 , 5 and 7 (creating the temporary file).
Is it possible to directly read (convert) such a handle into JPG format stored in a byte array or string?

I thought about using a RAM disk to create temporary files, but this requires installing additional software.

Sincerely Edward.

User avatar
serge_girard
Posts: 2361
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 610 times
Been thanked: 124 times
Contact:

Post by serge_girard » Wed Sep 11, 2019 8:47 pm

Maybe Claudio knows!

Serge

Post Reply