I've got a photo which has been masked inside an unconventional shape, which needs to sit over a single-coloured background.

If I save the image as a .png with transparency, I get a thin white line around the shape edge, which shows up against the coloured background.
If I save the image with a coloured background, the image and the site's background don't match (even though I've specified the same hex colour). I've tried exporting as .jpg and .png, out of Illustrator and Photoshop. The original image was masked with InDesign, is there a chance that rebuilding the artwork in Photoshop will help?

Has anyone got tips on how I get work around this?