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

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
Posts: 581
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 148 times
Been thanked: 510 times

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

Post by edk »

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
Posts: 2521
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
Location: Belgium
Has thanked: 825 times
Been thanked: 154 times

Post by serge_girard »

Maybe Claudio knows!


Post Reply