pdf transparency

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
cyklop
Posts: 7
Joined: 2010-06-10T22:20:58-07:00
Authentication code: 8675308

pdf transparency

Post 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');
Post Reply