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

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

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
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

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

Post by serge_girard »

Maybe Claudio knows!

Serge
There's nothing you can do that can't be done...
Post Reply