imagemagick将CMYK pdf转换为RGB jpeg或PNG并预先设置颜色 [英] imagemagick convert CMYK pdf to RGB jpeg or PNG and preseerve colors

查看:752
本文介绍了imagemagick将CMYK pdf转换为RGB jpeg或PNG并预先设置颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个cmyk pdf,我试图将其转换为RGB jpeg或png文件,但颜色与CMYK版本非常接近(与photoshop的版本相比)

I have a cmyk pdf that I am trying to convert to a RGB jpeg or png file but have the colors stay pretty close to what the CMYK version is (compared to how photoshop does it)

我正在尝试以下命令,但颜色从红色变为几乎明亮的霓虹红色等等。

I am trying the following command but the colors change drastically from a red color to almost bright neon red and so on.

这是命令

 convert cmykpdf.pdf +profile icc -profile AdobeRGB1998.icc -colorspace sRGB jpegtesting.jpg

有什么想法吗?或想法如何做到这一点。我尝试将其保存为PNG也出现了同样的问题,并尝试将sRGB更改为仅RGB

Any ideas? or thoughts on how to do this. I tried saving it as a PNG also and same issue occurs and have tried changing sRGB to just RGB

注意:它不一定需要是RGB jpeg它甚至可以是CMYK jpeg但我只是需要它才能正确显示在浏览器中我知道safari没有正确显示cmyk jpegs

NOTE: It doesnt necessarily need to be RGB jpeg it can even be CMYK jpeg but i just need it to be displayed in the browser correctly and I know safari does not display cmyk jpegs correctly

我的目标是在浏览器中显示一个img显示正确的颜色和正确的分辨率没有任何像素化

My goal is to just display a img in the browser that shows the correct color and correct resolution nothing pixilated

推荐答案

解决方案相当简单,对于Photoshop的CMYK到RGB没有什么巫术或特殊的如今。 Imagemagick使用LCMS颜色引擎,它可以很好地完成它的工作。

The solution is fairly easy, there's nothing voodoo or special about Photoshop's CMYK to RGB nowadays. Imagemagick uses LCMS color engine, which does its job just fine.

但首先你需要在IM的目录中编辑 delegates.xml 文件。找到委托decode =ps:cmyk的行,并在最后插入 -dUseCIEColor = false ,所以它看起来像这样:

But first you'll need to edit delegates.xml file inside IM's directory. Find the line with delegate decode="ps:cmyk" and insert -dUseCIEColor=false near the end, so it looks like that:

<delegate decode="ps:cmyk" restrain="True" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pamcmyk32&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; -dUseCIEColor=false &quot;-f%s&quot; &quot;-f%s&quot;"/>

这是必要的,因为否则Ghostscript(在返回 pam image to ImageMagick)将执行CMYK到CMYK转换(假设DeviceCMYK是基于CIE的CMYK),你可能不希望这样,因为颜色会发生相当大的变化。

It's necessary because otherwise Ghostscript (before returning pam image to ImageMagick) will perform CMYK to CMYK convertion (assuming DeviceCMYK to be CIEbased CMYK), and you probably don't want that, as colors will shift considerably.

然后尝试这个命令:

convert -density 144 cmyk.pdf -profile USWebCoatedSWOP.icc -resample 72 -profile "sRGB Color Space Profile.icm" -quality 100 out.jpg

这里我们采用cmyk.pdf(相反,临时pam GS返回IM的图像,分配CMYK配置文件(就像在Photoshop中一样,打开文件或明确地执行 - 因此选择描述最佳输入CMYK的配置文件),将其转换为sRGB配置文件(因为我不喜欢)你认为你想要AdobeRGB作为互联网图像的色彩空间)并保存到jpeg。根据需要降低质量参数。

Here we take cmyk.pdf (rather, temporary pam image that GS returns to IM), assign CMYK profile (just as you do in Photoshop, when you open a file or do it explicitly - therefore choose profile that describes you input CMYK best), convert it to sRGB profile (because I don't think you want AdobeRGB as color space of images for Internet) and save to jpeg. Reduce quality parameter as needed.

此处的另一个技巧是额外的手动消除锯齿 - 注意144 dpi和最终72 dpi的中间分辨率。因为我不认为Ghostscript与 -dGraphicsAlphaBits = 4 的抗锯齿与Photoshop的抗锯齿相同。

One more trick here is additional manual anti-aliasing -- note intermediate resolution of 144 dpi and final 72 dpi. Because I don't think that Ghostscript's anti-aliasing with -dGraphicsAlphaBits=4 is en par with Photoshop's anti-aliasing.

此命令的结果看起来完全与在Photoshop中转换的相同。

The result of this command looks exactly the same as converted in Photoshop.

这篇关于imagemagick将CMYK pdf转换为RGB jpeg或PNG并预先设置颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆