php - 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');
解决方案
推荐阅读
- java - 使用 Stream API 过滤器和 peek 运算符将字符串转换为地图
- javascript - 转换内容到 Base64 并发送到期望 MultiPartFile 的 Spring 方法
- java - Android上的图像和文件操作
- z3 - 如何在 Z3 中以 SMTLIB 格式表示集合成员?
- node.js - MongoDB 使用不和等于
- android - 如何在与firebase(FCM)的颤动中使用onBackgroundMessage,onBackgroundMessage没有被触发
- angular - 如何以角度更改chart.js中条形的颜色和宽度
- mysql - MySQL:引擎中不存在表“my_table”
- excel - 语法错误 CountIfs-function 多条件
- python - python函数参数中的三元运算符使用默认值