You can either convert your image to 32 bit alpha first and write into it afterwards.

Or create a new 32-bit BMAP with bmap_create(...), and use it as write target. That would be the normal way to manipulate a source image and save it under a different name.