Which imaging library are you using?
If you're using GD: it doesn't properly support PNG transparency, so transparent images such as the ones you've encountered will appear with a black background. I don't think that there's any way to change that color beyond modifying the image to always have a white background.
If you're using Imagick: it's a bug and you should file a ticket with the original of the offending image attached.