php Imagemagick fons negre jpg

Tinc un script php per crear una miniatura jpg de pdf de la següent manera;

<?php
$file ="test.pdf";
$im = new imagick(realpath($file).'[0]');
$im->setImageFormat("jpg");
$im->resizeImage(200,200,1,0);
// start buffering
ob_start();
$thumbnail = $im->getImageBlob();
$contents =  ob_get_contents();
ob_end_clean();
echo "<img src='data:image/jpg;base64,".base64_encode($thumbnail)."' />";
?>

Però el jpg resultant té fons negre en lloc de blanc .. Com puc solucionar-ho ??

6
задан hakre 14 June 2012 в 14:34
поделиться