For testing purpose I want to create a postscript file from a Tiff file. The image is in CMYK mode and I don't want to convert it to RGB.
I'm on Windows, and using Ghostscript to view the postscript file. I've tried to use the colorimage operator to draw the colored image form the picture encoded in hex.
3508 2480 scale
3508 2480 8 [3508 0 0 -2480 0 2480]
{currentfile 4 3508 mul string readhexstring pop} bind
false 4 colorimage
49492a00080000001200fe00040001000000000000000001030001000000
-- More Hex Data --
I expected this to compile with ghostscript but it return an error that I can't understand.
Error: /undefined in ??3
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
--nostringval-- --nostringval-- false 1 %stopped_push 2045 1 3 %oparray_pop 2044 1 3 %oparray_
pop 2025 1 3 %oparray_pop 1884 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostr
ingval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:973/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)--
Current allocation mode is local
Current file position is 4
GPL Ghostscript 9.26: Unrecoverable error, exit code 1
EDIT : So I succeed to extract raw binary data of a small image for test, thanks to photoshop and I wanted to create the image with each data source for each color so one source for cyan, one for magenta , ... And i got this file :
/cyan {
zz!!*'!s8W-!s8W-!zz!!*'!s8W-!s8W-!zz!!*'!s8W-!s8W-!zz!!*'!s8W-!s8W-!
-- More Data --
} /ASCII85Decode filter def
/magenta {
s8W-!s8W-!s8N'!zzs8W-!s8W-!s8N'!zzs8W-!s8W-!s8N'!zzs8W-!s8W-!s8N'!
-- More Data --
} /ASCII85Decode filter def
/yellow {
s8W-!s8W-!s8W-!s8W-!s8W-!s8W-!s8W-!s8W-!s8W-!s8W-!s8W-!s8W-!s8W-!
--More Data--
} /ASCII85Decode filter def
/black{
s8W-!s8W-!s8N'!zzs8W-!s8W-!s8N'!zzs8W-!s8W-!s8N'!zzs8W-!s8W-!s8N'!
--More Data--
} /ASCII85Decode filter def
/DeviceCMYK setcolorspace
20 20 8 [20 0 0 20 0 0]
cyan
magenta
yellow
black
true 4 colorimage
If you want the full code to test it : https://pastebin.com/6MFtw0M0
But Ghostscript keep returning me a cryptic error :
Error: /undefined in --colorimage--
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- colorimage --nostringval-- 2 %stopped_push --nostringval-- col
orimage colorimage false 1 %stopped_push 2045 1 3 %oparray_pop 2044 1 3 %oparray_pop 2025 1
3 %oparray_pop 1884 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- colo
rimage --nostringval-- 2 %stopped_push --nostringval-- 1913 10 3 %oparray_pop
Dictionary stack:
--dict:973/1684(ro)(G)-- --dict:0/20(G)-- --dict:82/200(L)--
Current allocation mode is local
GPL Ghostscript 9.26: Unrecoverable error, exit code 1
EDIT2 : So the data of my file was incorrect I tried with a different file and it worked !