覆盖 postscript/setcmykcolor [英] Overriding postscript /setcmykcolor

查看:63
本文介绍了覆盖 postscript/setcmykcolor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改仅包含矢量(无光栅)的 EPS 文件的颜色.目前,我将它们转换为 SVG,处理颜色,然后使用 Inkscape 将它们转换回 PDF 或 EPS.这非常有效,但不允许我应用 CMYK 着色,只能应用 RGB.在进行了一些调查并找到了诸如

并且我想将颜色转换为 CMYK = 0 1 1 0 看起来像这样:

在这种情况下,EPS 文件是黑色的,但也可以是任何其他颜色.我尝试在 %%BeginProlog 之后添加它,它应该覆盖 /setcmykcolor 以始终应用 0 1 1 0 作为 CMYK 颜色:

/osecmykcolor {/setcmykcolor} 绑定 def/setcmykcolor {pop [0 1 1 0] osecmykcolor} def

或者这个:

/osecmykcolor {/setcmykcolor} 绑定 def/setcmykcolor {0 1 1 0 osetmykcolor} def

但一切仍然是黑色的.我知道 /setcmykcolor 是正确的函数,因为在绘制路径之前使用 0 1 1 0 setcmykcolor 使其变为红色.我浏览了 postscript 编程手册,但我很难弄清楚这里出了什么问题!

任何帮助将不胜感激!

解决方案

如果我启动 Ghostscript 然后执行 :

GS>/osetmykcolor/setcmykcolor 加载 defGS>/setcmykcolor {pop pop pop pop 0 1 1 0 osetmykcolor} 绑定定义GS>(color.eps) 运行

然后 EPS 会按照您的预期以橙色"呈现.

请注意,setcmykcolor 需要 4 个参数,因此您必须弹出所有 4 个参数(尽管这不会导致缺少颜色,但只会在堆栈中留下垃圾).

编辑 EPS 文件:

%!PS-Adobe-3.0 EPSF-3.0%%BoundingBox:0 0 564 454%%HiResBoundingBox:0.00 0.00 564.00 453.20%% 创建者:GPL Ghostscript 921 (eps2write)%%语言等级:2%%CreationDate: D:20200616000003-03'00'%%页数:1%%EndComments%%开始序言/osetmykcolor/setcmykcolor 加载 def/setcmykcolor {pop pop pop pop 0 1 1 0 osetmykcolor} 绑定定义/DSC_OPDFREAD 真 def

然后运行它:

gs color1.eps

也会产生橙色文本.那么你如何测试它?

I'm trying to change the color from EPS files that contain only vectors (no rasters). Currently, I convert them to SVG, manipulate the colors, and convert them back to PDF or EPS with Inkscape. This works perfectly but doesn't allow me to apply CMYK coloring, only RGB. After investigating a little bit and finding answers like this or this I'm trying to override the /setcmykcolor function my EPS file uses. You can download it from here.

The EPS looks like this:

And I want to convert the color to CMYK = 0 1 1 0 so it looks like this:

In this case, the EPS file is black but it could be any other color. I tried adding this after %%BeginProlog which should override the /setcmykcolor to always apply 0 1 1 0 as the CMYK color:

/osetcmykcolor {/setcmykcolor} bind def /setcmykcolor {pop [0 1 1 0] osetcmykcolor} def

Or this:

/osetcmykcolor {/setcmykcolor} bind def /setcmykcolor {0 1 1 0 osetcmykcolor} def

But everything is still black. I know /setcmykcolor is the right function because using 0 1 1 0 setcmykcolor just before drawing the path makes it red. I went through postscript programming manuals but I'm having a hard time trying to figure out what's wrong here!

Any help would be greatly appreciated!

解决方案

If I start Ghostscript then do :

GS> /osetcmykcolor /setcmykcolor load def
GS> /setcmykcolor {pop pop pop pop 0 1 1 0 osetcmykcolor} bind def
GS> (color.eps) run

then the EPS is rendered in 'orange' as you expect.

Note that setcmykcolor takes 4 arguments so you have to pop all 4 (though this won't be causing a lack of colour, it's just leaving junk on the stack).

Editing the EPS file:

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 564 454
%%HiResBoundingBox: 0.00 0.00 564.00 453.20
%%Creator: GPL Ghostscript 921 (eps2write)
%%LanguageLevel: 2
%%CreationDate: D:20200616000003-03'00'
%%Pages: 1
%%EndComments
%%BeginProlog
/osetcmykcolor /setcmykcolor load def
/setcmykcolor {pop pop pop pop 0 1 1 0 osetcmykcolor} bind def
/DSC_OPDFREAD true def

and then running it with:

gs color1.eps

also produces orange text. So how are you testing it ?

这篇关于覆盖 postscript/setcmykcolor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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