PDF to PNG Transparency Problem
Posted: 2015-06-17T07:22:07-07:00
I have a pdf which have a transparent background and it also contains a white image, but the problem is when i am removing the background it's removing the white text also.
Here is the code i am using
I also tried adding but the problem is still remaining.
Here is the code i am using
Code: Select all
$imagename=time().'.png';
$userfile_tmp = $_FILES['image']['tmp_name'];
$im = new Imagick($userfile_tmp);
// $im->flattenImages();
$im->setImageFormat('png');
// $im->paintTransparentImage('white', 0, 10000);
$im->paintTransparentImage($im->getImageBackgroundColor(), 0, 10000);
$im->setImageColorspace(imagick::COLORSPACE_CMYK);
$im->writeImage('pdftopng/'.$imagename);
$run = exec("convert pdftopng/".$imagename." -fill none -draw 'matte 0,0 floodfill' -shave 1x1 pdftopng/".$imagename);
Code: Select all
-transparent white