SVG to PNG using imagick changing colour

Viewed 73

I'm using imagick to convert SVG to PNG, but after the conversion the colour is slightly different, I've done the following snippet to change the SVG.

$src = 'File Path';
$im = new Imagick();
$svg = file_get_contents($src);
$im->readImageBlob($svg);
$im->setImageFormat("png32");
$im->resizeImage(3000, 3000, imagick::FILTER_LANCZOS, 1);
echo '<img src="data:image/png;base64,' . base64_encode( $im ) . '" />';
$im->clear();
$im->destroy();

Kindly help me with a way how can I convert SVG to PNG using php and maintaining exact colour codes.

0 Answers
Related