| <<<Back 1 day (to 2017/11/11) | 20171112 |
Sven_vB | I tried to convert a PDF to greyscale using my battle-tested script for it, but today, suddenly, my ghostscript doesn't know the device "psgray" any longer. any ideas? GPL Ghostscript 9.10 (2013-08-30), Ubuntu 14.04.5 LTS trusty | 21:26.16 |
| in some forum thread I found this alternative: gs -sDEVICE=ps2write -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dSAFER -dNOPLATFONTS -dQUIET file.pdf - | 21:27.47 |
| but it just says "**** Unable to open the initial device, quitting." | 21:27.51 |
| even though that one is in the list from <<<'devicenames ==' gs | 21:28.29 |
pipitas | Sven_vB: Try the following commands: | 21:35.18 |
| $ mkdir t | 21:35.18 |
| $ chmod a+w t | 21:35.18 |
| $ gs -o t/t.pdf -sDEVICE=pdfwrite -c showpage # <= this would create a PDF containing just an empty page. | 21:35.18 |
| Sven_vB: Does it work? | 21:36.24 |
| NO! | 21:36.24 |
| Why not? | 21:36.24 |
| Because you do not have write access to the newly created directory! (Remember your "chmod a-w t" command?) | 21:36.24 |
| Arrrgghhhhâ¦. I gave the wrong "chmod" command. Should have been "chmod a-w t"⦠| 21:37.00 |
pipitas | suspects that Sven_vB simply lacks writing permissions to put the file where he wants to put it⦠| 21:38.03 |
Sven_vB | thanks, will try! | 21:41.32 |
| well before that I'll try strace | 21:42.35 |
| oh. ok. mmap2( on a pipe probably won't work. | 21:47.09 |
| so I'll try with a temp file then. | 21:47.17 |
| really strange. there's no other occurrence of "tmp.foo" in the strace -y log after execve("/usr/bin/gs", ["gs", "-sDEVICE=ps2write", "-sOutputFileName=tmp.foo.ps", "-sColorConversionStrategy=Gray", "-dProcessColorModel=/DeviceGray", "-dSAFER", "-dNOPLATFONTS", "-dQUIET", "foo1.pdf"], [/* 73 vars */]) = 0 | 21:57.03 |
| I'll try with a dir anyway, as you suggested | 21:57.39 |
| "mkdir --mode=0000 t" created a dir with no access for me. strace is same except that the first (still only) match of tmp.foo is now "-sOutputFileName=t/tmp.foo.ps" | 22:00.15 |
| chmod 0775 t -> ok; still same in strace | 22:01.49 |
| in case it helps, these are the last few lines: https://gist.github.com/mk-pmb/764dd0fd7b644ba208c2e08fb6346921 | 22:03.26 |
| oh. my earlier assumption was wrong about the pipe stuff: seems the mmap2( that I thought was the problem, has nothing to do with the output filename. | 22:04.59 |
| well, I'll try the empty page thing. | 22:06.00 |
pipitas | My gs command with the empty page was just to demo to you that the "cannot open initial device" message CAN come from no write access. | 22:08.16 |
| You can see if you can write in the current dir by just running "touch tmp.foo.ps"⦠| 22:08.45 |
Sven_vB | hey cool, thanks! I looked really hard at it and then noticed you used -o for the filename. now with that, something else happens. I'll investigate | 22:09.37 |
| it = your gs command | 22:10.04 |
| oh ok had to change the device back to ps2write. :) now it actuall produces ps, although that ASCII85Decode flavor. gonna ask search engines. :) | 22:12.48 |
| pipitas, I got it to work again! many thanks for your help! | 22:54.05 |
| @ log readers: you can find the ghostscript compression options explained in the ps2ps2 webpage, https://ghostscript.com/doc/current/Ps2ps2.htm | 22:54.58 |
| Forward 1 day (to 2017/11/13)>>> | |