Page 1 of 1

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

Posted: Wed Sep 11, 2019 8:41 pm
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.

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

Posted: Wed Sep 11, 2019 8:47 pm
by serge_girard
Maybe Claudio knows!

Serge