Convert SVG to PNG image
<p>I have tried to convert the svg to png image . I have used below php code.</p>

<pre><code>$image = new Imagick();
$image-&gt;readImageBlob(file_get_contents('image.svg'));
$image-&gt;setImageFormat("png24");
$image-&gt;resizeImage(1024, 768, imagick::FILTER_LANCZOS, 1); 
$image-&gt;writeImage('image.png');
</code></pre>

<p>The below error was found</p>

<pre><code>Fatal error: Uncaught exception 'ImagickException' with message 'WriteBlob Failed `image.png' @ error/png.c/MagickPNGErrorHandler/1645' in /var/www/html/image.php:8 Stack trace: #0 /var/www/html/image.php(8): Imagick-&gt;writeimage('image.png') #1 {main} thrown in /var/www/html/image.php on line 8
</code></pre>

<p>What am I doing wrong?</p>