I am trying to dynamically generate images from svg files using imagemagick and the imagick wrapper, but the converted png's always have white backgrounds rather than transparent. Does anyone know how to make them transparent without having to erase all the white areas?

Heres my code

PHP Code:
$im = new Imagick();
$svg file_get_contents("design.svg");
$svg str_replace(array("color1","color2"),array("red","lightblue"),$svg);
$im->setImageBackgroundColor(new ImagickPixel('transparent'));

header("Content-Type: image/png");