Transparency in images will be set on pixels at varying strengths around the edges depending on how the colour of the pixel opposes the colour of the background.
So the best you can probably do is set the background to a mid grey and fix the transparency levels against that. It won't be perfect on white or black backgrounds, but anything in between will get somewhere between 50% to 100% right.
Whereas an image with a light background and transparency set, vs. putting the image on a dark background, would create a greater than 50% offset with light edge pixels causing a halo to appear around the object.
The closer you can target the image to the background it is upon the better, so in the end you may need multiple images and to decide when it is right to use each.