Discussion:
[tex-k] patch to epstopdf
William Bader
2016-02-10 00:37:08 UTC
Permalink
Hi,
I attached a small patch to epstopdf that adds a "-gray" option to produce a B&W PDF.
I get EPS files from various sources that I need to print without triggering a color separation.
Regards,
William
Karl Berry
2016-02-10 19:11:38 UTC
Permalink
I attached a small patch to epstopdf that adds a "-gray" option to produce a B&W PDF.

Good idea, thanks!
Volker Kuhlmann
2016-02-13 19:46:55 UTC
Permalink
On Thu 11 Feb 2016 08:11:38 NZDT +1300, Karl Berry wrote:

> I attached a small patch to epstopdf that adds a "-gray" option to
> produce a B&W PDF.
>
> Good idea, thanks!

Not so fast. Can we please maintain the distinction between colour,
grey, and monochrome? B&W refers to monochrome (1 bit), grey refers to
8 bit (or 16 bit), and colour to 24 or 48 bit. The file sizes behave
accordingly, and compression ratios for monochrome are really good,
unless files are contructed lazily as grey although only 1 bit of the 8
bit storage width is actually used.

So if adding an option for grey in a not very big patch, how about also
adding an option for monochrome, like -mono or -bw, with the appropriate
PS commands?

Volker

--
Volker Kuhlmann
http://volker.top.geek.nz/ Please do not CC list postings to me.
William Bader
2016-02-13 20:25:18 UTC
Permalink
> Date: Sun, 14 Feb 2016 08:46:55 +1300
> From: ***@paradise.net.nz
> Subject: Re: [tex-k] patch to epstopdf
> To: ***@freefriends.org
> CC: ***@hotmail.com; tex-***@tug.org
>
> On Thu 11 Feb 2016 08:11:38 NZDT +1300, Karl Berry wrote:
>
> > I attached a small patch to epstopdf that adds a "-gray" option to
> > produce a B&W PDF.
> >
> > Good idea, thanks!
>
> Not so fast. Can we please maintain the distinction between colour,
> grey, and monochrome? B&W refers to monochrome (1 bit), grey refers to
> 8 bit (or 16 bit), and colour to 24 or 48 bit. The file sizes behave
> accordingly, and compression ratios for monochrome are really good,
> unless files are contructed lazily as grey although only 1 bit of the 8
> bit storage width is actually used.
>
> So if adding an option for grey in a not very big patch, how about also
> adding an option for monochrome, like -mono or -bw, with the appropriate
> PS commands?
>
> Volker
> --
> Volker Kuhlmann
> http://volker.top.geek.nz/ Please do not CC list postings to me.


My issue is that I am sending newspaper pages to an imager, and I don't want a color photo, for example, to trigger a CMYK separation on an interior page that can't print color. I am not doing the color to grayscale conversion to reduce the size.
I usually identify pages as either color or B&W, but I should have been more careful in the terminology.
In any case, I am not sure if ghostscript has an option to control the number of bits per sample. I tried a few options, but I still got 8 bit grayscale instead of 1 bit. The ghostscript pstopdf documentation is at http://www.ghostscript.com/doc/current/Ps2pdf.htm
If you can find a gs option that makes 1 bit B&W, I can revise my patch to add a -bw flag.
Regards, William
Volker Kuhlmann
2016-02-13 22:50:52 UTC
Permalink
On Sun 14 Feb 2016 09:25:18 NZDT +1300, William Bader wrote:

> My issue is that I am sending newspaper pages to an imager, and I
> don't want a color photo, for example, to trigger a CMYK separation
> on an interior page that can't print color. I am not doing the color
> to grayscale conversion to reduce the size. I usually identify pages
> as either color or B&W, but I should have been more careful in the
> terminology.

I think it is important in image processing to be clear about the
grey/bicolor difference. Command line options should reflect that. Given
that B&W is often used ambigously it would probably be better to refer
to monochrome instead.

> In any case, I am not sure if ghostscript has an option
> to control the number of bits per sample. I tried a few options, but
> I still got 8 bit grayscale instead of 1 bit. The ghostscript pstopdf
> documentation is at http://www.ghostscript.com/doc/current/Ps2pdf.htm

Thanks for the link - it looks like RGB, CMYK and Grey are the only
device colour models. I don't know whether that is a limitation of
ghostscript or postscript, but it means there can't be a -monochrome
flag, only a -grey one.

Perhaps I have been thinking of PDF, which is definitely capable of
monochrome images (PS might not be). PDF files with images converted to
monochrome are a fraction of the size (this always uses a fax CCITT
compression) as the same image as grey scale. E.g. vuescan (hamrick.com)
creates these accordingly, and it's a really good scanner program.

Volker

--
Volker Kuhlmann
http://volker.top.geek.nz/ Please do not CC list postings to me.
Karl Berry
2016-02-13 23:37:13 UTC
Permalink
monochrome images (PS might not be)

I cannot speak to "color models", and Ghostscript options are yet
another world, but PostScript the language certainly supports monochrome
images, in that the venerable image operator handles images with depths
of 1, 2, 4, or 8 bits.

I can't say I know what to make of it in practice,
http://www.ghostscript.com/doc/current/Ps2pdf.htm does list various
Mono* parameters. William, is that what you were tinkering with?

In any case, I see no reason not to add the grayscale option just
because we haven't figured out the monochrome option.

Thanks,
Karl
William Bader
2016-02-14 01:12:58 UTC
Permalink
> Date: Sat, 13 Feb 2016 23:37:13 +0000
> From: ***@freefriends.org
> To: ***@paradise.net.nz
> CC: ***@hotmail.com; tex-***@tug.org
> Subject: Re: [tex-k] patch to epstopdf
>
> monochrome images (PS might not be)
>
> I cannot speak to "color models", and Ghostscript options are yet
> another world, but PostScript the language certainly supports monochrome
> images, in that the venerable image operator handles images with depths
> of 1, 2, 4, or 8 bits.
>
> I can't say I know what to make of it in practice,
> http://www.ghostscript.com/doc/current/Ps2pdf.htm does list various
> Mono* parameters. William, is that what you were tinkering with?
>
> In any case, I see no reason not to add the grayscale option just
> because we haven't figured out the monochrome option.
>
> Thanks,
> Karl


Yes, I tried ps2pdf -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dColorImageDepth=1 -dGrayImageDepth=1 -dMonoImageDepth=1 colorcir.ps
but I still came up with grayscale image. It might be possible with a custom ICC profile.
At least for printing, I am not sure if converting to 1 bit monochrome would ever be useful. Images would come out very ugly. RIPs need to see grayscales in order to generate halftones.
Regards, William
Volker Kuhlmann
2016-02-20 06:27:09 UTC
Permalink
On Sun 14 Feb 2016 14:12:58 NZDT +1300, William Bader wrote:

> Yes, I tried ps2pdf -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dColorImageDepth=1 -dGrayImageDepth=1 -dMonoImageDepth=1 colorcir.ps
> but I still came up with grayscale image. It might be possible with a custom ICC profile.
> At least for printing, I am not sure if converting to 1 bit monochrome would ever be useful. Images would come out very ugly. RIPs need to see grayscales in order to generate halftones.

Thanks for the details! What you say may be correct for printing, but
does not hold for archiving. When I create PDFs for the purpose of
storing documents electronically without intention to print them,
being forced to use images in 8-bit grey rather than 1-bit B&W looks
like an unwelcome limitation to me. Those 1-bit documents (not created
by ghostscript) still print fine on the odd occasion I tried, so RIPs
can cope in principal. Whether the quality was as good as it would have
been with 8-bit grey I didn't check, and it was irrelevant for the
purpose.

The bottom line is still if ghostscript can't generate 1-bit images then
epstopdf can't change that, and a different tool would be in order.

Thanks,

Volker

--
Volker Kuhlmann
http://volker.top.geek.nz/ Please do not CC list postings to me.
Loading...