pixel_for_bmap gets the pixel-color/alpha of the bmap in a single float variable.
pixel_to_vec converts it to a color-vector, which is temp here.
pixel_for_vec again returns such a float variable
pixel_to_bmap writes it to the position again

the only thing i could think of, that you convert that bmap to another format(with alpha), but i don't know a function that does that. So try to save them already as 32-bit tgas. Then it should work.