2017-03-06 11:12
浏览 62

PHP - 使用Imagick将EPS转换为PNG

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->setBackgroundColor(new ImagickPixel('transparent'));
        $image->scaleImage(600, 270);

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

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • douyan1970 2017-03-06 14:30

    The function setResolution should be called before reading the image. Thus

     $image = new Imagick();
     $image->setResolution(1200, 1200);

    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.

    解决 无用
    打赏 举报

相关推荐 更多相似问题