Discussion:
Odd results from GhostScript
(too old to reply)
Rob Hemmings (News)
2020-06-10 13:50:20 UTC
Permalink
I've been playing with GhostScript (version 9.26) on RISC OS as I was
intending to write a RISC OS front end to calculate printing costs and I
need to use GhostScript to give an estimation of the amount of each
colour of ink needed to print a (pdf) file. However, I'm getting some
strange results and would appreciate any ideas or suggestions.

I'm using the GhostScript device of ink_cov to do the calculation. An
actual command line that demonstrates the issue is:

gs -o - -sDEVICE=ink_cov inputfile

(where I replace "inputfile" with the name of the file I am trying to
analyse)

I'm using version 9.2 of GhostScript on Windows and that is producing
consistent results with any type of pdf file. On RISC OS I get a
believable result if I use a pdf file that has been created on Windows
with colour in CMYK format although a little oddly the results are
slightly different from those produced on Windows with the same file
which I would have expected to be the same.

However, much more of a problem on RISC OS is that with a pdf file that
has not been created in CMYK colour it reports exactly the same
(incorrect) figure for each ink instead of giving the correct
proportions. Running GhostScript on the same file on Windows gives a
correct result with the usage of each ink being different. Can anyone
suggest what might be going on?
--
-------------------------------------------------------------
Rob Hemmings Southport

***@dsl.pipex.com
Theo
2020-06-10 16:57:11 UTC
Permalink
Post by Rob Hemmings (News)
I'm using version 9.2 of GhostScript on Windows and that is producing
consistent results with any type of pdf file. On RISC OS I get a
believable result if I use a pdf file that has been created on Windows
with colour in CMYK format although a little oddly the results are
slightly different from those produced on Windows with the same file
which I would have expected to be the same.
However, much more of a problem on RISC OS is that with a pdf file that
has not been created in CMYK colour it reports exactly the same
(incorrect) figure for each ink instead of giving the correct
proportions. Running GhostScript on the same file on Windows gives a
correct result with the usage of each ink being different. Can anyone
suggest what might be going on?
How strange. It appears there are two devices, 'ink_cov' and 'inkcov' which
follow different code paths:
https://github.com/ArtifexSoftware/ghostpdl/blob/master/devices/gdevicov.c
Are you sure you're using the same one?
Also, are you sure the DPI is the same (default is 75 dpi) and not getting
set by some config file maybe?

Otherwise I'm wondering if there's some undefined behaviour in there
somewhere, but I can't see anything obvious...

Theo
Rob Hemmings (News)
2020-06-10 18:04:31 UTC
Permalink
Post by Theo
Post by Rob Hemmings (News)
I'm using version 9.2 of GhostScript on Windows and that is producing
consistent results with any type of pdf file. On RISC OS I get a
believable result if I use a pdf file that has been created on Windows
with colour in CMYK format although a little oddly the results are
slightly different from those produced on Windows with the same file
which I would have expected to be the same.
However, much more of a problem on RISC OS is that with a pdf file
that has not been created in CMYK colour it reports exactly the same
(incorrect) figure for each ink instead of giving the correct
proportions. Running GhostScript on the same file on Windows gives a
correct result with the usage of each ink being different. Can
anyone suggest what might be going on?
How strange. It appears there are two devices, 'ink_cov' and 'inkcov'
https://github.com/ArtifexSoftware/ghostpdl/blob/master/devices/gdevicov.c
Are you sure you're using the same one? Also, are you sure the DPI is
the same (default is 75 dpi) and not getting set by some config file
maybe?
Otherwise I'm wondering if there's some undefined behaviour in there
somewhere, but I can't see anything obvious...
Theo
Hi Theo, thanks for the thoughts. I'm definitely using ink_cov as inkcov
does not report on ink usage but on which areas of the page include an
ink (i.e. it takes no notice of density). That confused me quite a bit
to begin with as the documentation for them is fairly thin.

I hadn't thought about DPI but as far as I know I've done nothing to
affect that as I've just tried running exactly the same command on the
same file on both platforms, admittedly with a slightly different version
number of GhostScript. I suppose it is possible that could affect the
first issue I've mentioned above. However, I don't see how altering DPI
surely could not make all ink coverage values the same when they are
clearly not if you look at the document.
--
-------------------------------------------------------------
Rob Hemmings Southport

***@dsl.pipex.com
Loading...