CGImage supports a wide variety of content, including formats that are 16 bits per channel, and have non RGB colorspaces, half-float samples, etc. So the above code (second example) doesn’t necessarily handle these cases correctly. The function will do conversions and such, but it isn’t guaranteed that the source colorspace combined with a 32-bit four channel pixel make any sense. More likely, it may just be you are visualizing the contents of the vImage buffer incorrectly. I would be especially cautious of endian problems. The image could be BGRA and you might be visualizing it as ARGB or RGBA, for example. As you can see for some of these cases the alpha and blue channels can be swapped and in those cases the mostly opaque alpha will become a mostly blue image, with some swapping also of red and green.
What is primarily missing in this problem description is how you are visualizing the vImage buffer. You also should go find out what the colorspace and CGBitmapInfo for the image are and report back. The colorspace will self report its contents using the po command in the debugger. The CGBitmapInfo bit field may or may not resolve itself in the debugger but it is fairly simple to decode by hand.