Page 1 of 1

pdf transparency

Posted: 2010-06-10T22:53:03-07:00
by cyklop
Hi,

I'm trying to make a thumbnail of any kind of pdf. If the pdf has any kind of transparency I will put a checkerboard behind the image to show the user that there is a transparency.
But IM is automaticly changing the transparency into white. If I open the same pdf with PS I can see the transparency, but not in my thumbnail. This is my code:

Code: Select all

$objImage = new Imagick('welle.pdf');

$objImage->thumbnailImage(350,350, true);

$objTmpImage = new Imagick();
$objTmpImage->newPseudoImage(350,350, 'pattern:checkerboard');
$objTmpImage->setImageColorspace($objImage->getImageColorspace());
	
$objTmpImage->compositeImage($objImage, imagick::COMPOSITE_DEFAULT, 0, 0);
$objImage = $objTmpImage;

$objImage->setImageType(imagick::IMGTYPE_TRUECOLOR);
$objImage->setImageFormat("jpg");
$objImage->setImageCompression(imagick::COMPRESSION_JPEG);
$objImage->setCompressionQuality(80);
$objImage->setImageResolution(72,72);
$objImage->writeImage('test.jpg');