Bug 695078 - Color settings are inverted
Summary: Color settings are inverted
Status: RESOLVED INVALID
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Color (show other bugs)
Version: master
Hardware: PC Linux
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-28 14:06 UTC by Victor Porton
Modified: 2014-03-01 08:58 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
wrongly printed file (3.63 KB, application/pdf)
2014-02-28 14:06 UTC, Victor Porton
Details
wrongly printed file (11.44 KB, application/postscript)
2014-02-28 14:08 UTC, Victor Porton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Porton 2014-02-28 14:06:25 UTC
$ pcal 03 2014 > ~/t/cal.ps
$ ps2pdf ~/t/cal.ps ~/t/cal.pdf
$ acroread ~/t/cal.pdf

Then I printed it in Acrobat Reader with its "Output Mode" setting being "Color" and "High Quality Grayscale". They outputted no gray regions at all or gray regions as VERY fade color which a man would have trouble to read.

But! When I've set Acrobat Reader to "Black Only Grayscale" it printed a high quality page with all needed degrees of gray.

It seems that we have a trouble with GhostScript confusing different "Color" settings.

$ gs -version
GPL Ghostscript 9.05 (2012-02-08)

See also https://savannah.gnu.org/bugs/index.php?41737 for more bugs.
Comment 1 Victor Porton 2014-02-28 14:06:59 UTC
Created attachment 10729 [details]
wrongly printed file
Comment 2 Victor Porton 2014-02-28 14:08:13 UTC
Created attachment 10730 [details]
wrongly printed file
Comment 3 Ken Sharp 2014-03-01 01:00:58 UTC
No Ghostscript command line supplied, running to the display device however looks broadly similar to the attached PDF. Running through Acrobat Distiller produces a file which looks the same as the PDF and the Ghostscript output.

I can't see what the problem is here. If you don't like the way Acrobat prints the file, I don't see that as a Ghostscript problem.
Comment 4 Ken Sharp 2014-03-01 02:19:43 UTC
Copy of my post to comp.lang.postscript summarising my findings:

In the original cal.ps I see that the dates are either black, gray, outlined or outlined in gray. The gray colour used is defined as:

/dategray 0.800 def

which sets the gray for the dates as 20% gray (0 = black, 1 = white) so its quite a light gray.

Looking in the resulting PDF file I see that we set 0.800781 g (rounding errors internally here) so the PDF file maintains essentially the same colour in the same colour space. Eg:

0.800781 g
q
10 0 0 10 0 0 cm BT
/R8 25 Tf
0 1 -1 0 107.75 650 Tm
(1)Tj
-600 -80 Td
(2)Tj
ET
Q
0 g
q
10 0 0 10 0 0 cm BT
/R8 25 Tf
0 1 -1 0 187.75 150 Tm
[(3)-3500(4)-3500(5)-3500(6)-3500(7)]TJ
ET

As you can see this draws the numbers '1' and '2' in 20% gray and the numbers 3, 4, 5, 6 and 7 in 100% gray (black).

This is precisely what I see in the display when viewed in Acrobat. We can't be held responsible for what Adobe Acrobat, the Windows printing system, and the final printer make of this, but there is no bug in Ghostscript.
Comment 5 Victor Porton 2014-03-01 06:05:52 UTC
I've opened the attached file cal.ps in Okular.

I clicked "Print" in the menu.

I set "Color Mode" to "Color".

Then I printed in two different modes of "Output Mode" (in advanced properties): "Color" and "Black Only Grayscale".

In "Black Only Grayscale" it printed with good grayscale look.

In "Color" mode it printed with VERY fade color, almost black and white only.

(Note the mode I changed in advanced properties has nothing to do to "Color Mode" which remained "Color" during both printings.)

So "Black Only Grayscale" and "Color" modes are probably inverted.

The result with Okular is the same as with Acrobat Reader, so the bug is in GhostScript.
Comment 6 Victor Porton 2014-03-01 06:09:36 UTC
My printer:

HP Deskjet 1050 j410
Comment 7 Victor Porton 2014-03-01 06:15:58 UTC
$ cat ~/t/cal.ps | lpr -P Deskjet_1050_J410 -o PageSize=Letter -o PageRegion=Letter -o InputSlot=Auto -o ColorModel=RGB -o MediaType=Plain -o OutputMode=Normal

prints black and white.

$ cat ~/t/cal.ps | lpr -P Deskjet_1050_J410 -o PageSize=Letter -o PageRegion=Letter -o InputSlot=Auto -o ColorModel=KGray -o MediaType=Plain -o OutputMode=Normal

prints high quality grayscale (or maybe color, my .ps is without colors).

So the modes ColorModel=RGB and ColorModel=KGray are reversed!

(Note that the file cal.ps is attached.)
Comment 8 Victor Porton 2014-03-01 07:35:53 UTC
Don't forget to test also ColorModel=CMYGray
Comment 9 Ken Sharp 2014-03-01 07:56:17 UTC
You have yet to tell me how creating a PDF file with Ghostscript, and printing it from Acrobat two different ways results in 2 different outputs can be a Ghostscript bug.

The PDF is, as far as I can tell, correct. The gray value is 20% gray which is the same as in your PostScript file. Testing by printing from other applications does not involve Ghotscript (caveat; it might if you are using CUPS) so this is not useful as a test or comparison.

As far as I am concerned, there is no bug in Ghostscript the PDF file is valid, display as expected in Acrobat Reader, and has hte same gray values as the original PostScript.
Comment 10 Ken Sharp 2014-03-01 08:00:27 UTC
(In reply to comment #7)
> $ cat ~/t/cal.ps | lpr -P Deskjet_1050_J410 -o PageSize=Letter -o
> PageRegion=Letter -o InputSlot=Auto -o ColorModel=RGB -o MediaType=Plain -o
> OutputMode=Normal
> 
> prints black and white.
> 
> $ cat ~/t/cal.ps | lpr -P Deskjet_1050_J410 -o PageSize=Letter -o
> PageRegion=Letter -o InputSlot=Auto -o ColorModel=KGray -o MediaType=Plain
> -o OutputMode=Normal
> 
> prints high quality grayscale (or maybe color, my .ps is without colors).
> 
> So the modes ColorModel=RGB and ColorModel=KGray are reversed!

What does htis have to do with Ghostscript ? You appear to be using lpr. Possibly lpr is using CUPS, in which case many different filters could be used.

Unless you can give me a Ghostscript command line which demonstrates a problem *with Ghostscript* I'm not going to look any further at this as I do not believe there is a bug in Ghostscript. (you can point me to a portion of hte PDF content stream which is incorrect if you like, as long as you explain why its incorrect)
Comment 11 Victor Porton 2014-03-01 08:49:54 UTC
(In reply to comment #10)
> (In reply to comment #7)
> > $ cat ~/t/cal.ps | lpr -P Deskjet_1050_J410 -o PageSize=Letter -o
> > PageRegion=Letter -o InputSlot=Auto -o ColorModel=RGB -o MediaType=Plain -o
> > OutputMode=Normal
> > 
> > prints black and white.
> > 
> > $ cat ~/t/cal.ps | lpr -P Deskjet_1050_J410 -o PageSize=Letter -o
> > PageRegion=Letter -o InputSlot=Auto -o ColorModel=KGray -o MediaType=Plain
> > -o OutputMode=Normal
> > 
> > prints high quality grayscale (or maybe color, my .ps is without colors).
> > 
> > So the modes ColorModel=RGB and ColorModel=KGray are reversed!
> 
> What does htis have to do with Ghostscript ? You appear to be using lpr.
> Possibly lpr is using CUPS, in which case many different filters could be
> used.
> 
> Unless you can give me a Ghostscript command line which demonstrates a
> problem *with Ghostscript* I'm not going to look any further at this as I do
> not believe there is a bug in Ghostscript. (you can point me to a portion of
> hte PDF content stream which is incorrect if you like, as long as you
> explain why its incorrect)

I thought that lpr uses GhostScript when printing .ps files. If I am wrong about this, please explain me how lpr converts from PostScript to printer output, so I could be able to report the bug where I should.

And yes, CUPS is installed on my Debian Linux.
Comment 12 Ken Sharp 2014-03-01 08:58:12 UTC
(In reply to comment #11)

> I thought that lpr uses GhostScript when printing .ps files. If I am wrong
> about this, please explain me how lpr converts from PostScript to printer
> output, so I could be able to report the bug where I should.

I have no idea how CUPS does this, you should probably take it up with the CUPS team. In order to get a Ghostscript command line you will need to do this anyway.

As  I have said, from the information presented here (ie using psd2pdf) there is nothing to suggest a Ghostscript problem.