I am trying to convert eps to png image using imagick.This is the code i am using.
$path = getcwd().'/uploads/1488/791/586/imprint_option_1A.eps'; $save_path = getcwd().'/uploads/1488/791/586/imprint_option_2E_c.png'; $image = new Imagick(); $image->readimage($path); $image->setBackgroundColor(new ImagickPixel('transparent')); $image->setResolution(300,300); $image->scaleImage(600, 270); $image->setImageFormat("png"); $image->writeImage($save_path);
but the transparency is not working i got image with white background ( Result image ). and when we scale image it loses clarity..
Any idea ?
Here is my eps file https://drive.google.com/open?id=0Bwq4DvGGbHVfT0FYTE94WW5GTnc
The function setResolution should be called before reading the image. Thus
$image = new Imagick();
$image->setResolution(1200, 1200);
$image->readImage($path);
should do it. As for the transparency, can you try to get the input as sRGB instead of CMYK? If I convert first the input file to pdf with epstopdf
and then use this converted file in the PHP script, it produces a transparent PNG file.