将CMYK PDF转换为RGB JPG变黑

问题描述

这是几年前设置的,并且运行良好:

DO_DIRECT

但是今天,它决定不再使用它了。 我正在生成使用PMS颜色的CMYK PDF,如下所示:

screenshot of PDF

它一直在转换,但是现在决定转换为这个:

converted jpg

我尝试上传不同的较新的RGB和CMYK配置文件,但没有任何困难,要么没有做任何不同,要么反转了颜色。我完全不知所措。我根本没有更改此文件。我一直在更新网站的其他方面,这些方面大约是10年前编码为MySQL查询的,并且需要使用准备好的语句更新为mySQLi。

解决方法

如@ fmw42所述,setImageColorspace无法正常工作。 我最终完全删除了配置文件,仅使用setColorspace。像这样:

// create Imagick object
$imagick = new Imagick();
// Sets the image resolution
$imagick->setResolution(300,300);
// set color space
$imagick->setColorspace(Imagick::COLORSPACE_SRGB);
// Reads image from PDF
$imagick->readImage($pdf_here);
// crop to trim size
$imagick->cropImage(1050,600,37.5,37.5);
// Writes an image
$imagick->writeImage($jpg_here);

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...