首页 > 解决方案 > Convert an EPS file with transparency and CMYK colorspace to PNG with ImageMagick

问题描述

I would like to convert an EPS vector graphics (CMYK) file to PNG, with PHP ImageMagick, keeping the transparency. I can easily do it in command line with the following command:

 convert -colorspace RGB test_file_with_transaprency.eps PNG32:result_with_transparency.png

But my attempts with the PHP version fail, producing white background. I got it working with SVG though, so this works when converting from SVG.

        $image = new \Imagick();
        $image->setBackgroundColor(new \ImagickPixel('transparent'));
        $image->readImageBlob(file_get_contents($sourceImagePath));
        $image->writeImage('./vector_test/eps_to_png_test.png');

标签: phpimagemagickpngeps

解决方案


推荐阅读