[cups.development] Interested in writing a cups driver...

Michael R Sweet msweet at apple.com
Fri Sep 5 04:53:08 PDT 2008

Collin Day wrote:
> Hello all,
> I own an HP Photosmart Pro b8850.  I am using it to print photos.  I
> know that there are PPD's and drivers out there that work with this
> printer, but none seem to have everything that I want.  For example,
> the HPLIP does not yet support using just the gray inks for photos
> (but they are working on it) and they have no plans to support 16 bit
> images - everything has to be moved to 8 bit.  I prefer to edit and
> do work in 16 bits.  After a little research, it seems cups would
> support a 16bit/channel input (I think - please correct if I am
> mistaken).

CUPS does support 16-bits/channel, although there are specific raster
filters that currently do not support a "clean" 16-bit path in the
open source world.  Ghostscript is one - it is limited to 15-bits/
channel internally - and imagetoraster currently maps from 8-bits to

> ...
> Q1.  HP says that the printer uses PCL3 GUI, but a lot of the drivers
> I see indicate PS driver types.  Should I try to use PCL or is PS the
> preferred method?  Does anyone know the advantages and disadvantages
> - all I can read right now is that PS is good for mainly vector
> images while raster is the way to go if you are interested in
> printing photos (that would be me).

OK, a couple things.  First, PCL3GUI is actually a low-level raster
version of PCL3 that provides access to the printer-specific bit depths,
resolutions, and color channels.

Second, PS (PostScript) is a high-level page description language that
supports both vector and raster graphics.  In CUPS, PostScript is
typically converted to CUPS raster data (application/vnd.cups-raster)
by Ghostscript or the corresponding filters on Mac OS X.  Older
drivers use similar interfaces (like HP's old IJS interface with
Ghostscript) to get raster data.

So, for this printer you want to write a PCL3GUI driver filter that
reads CUPS raster data.  You will also provide a PPD file (which can
be generated using the CUPS DDK tools - I highly recommend using them!)
that tells CUPS to send raster data to your filter and what settings
to use when generating the raster data ("I want 16-bit Gray at 1200dpi",

> Q2.  I can't seem to figure out how/where you would tell the printer
> to use only certain inks - I see RGB and CMYK mentioned a lot, as
> well as ICC profiles for different numbers of inks.  Just for simple
> purposes, does anyone know approximatley hoew you would go about
> printing a B/W photo with just gray inks so that you are not using
> any of the CMY colors?

That depends a lot on the printer.  If you can figure out the channel
mapping used by your printer, you can dither from the input grayscale
to the inks in the printer.  Fortunately, calibrating gray inks is
simpler than full color, so you mainly need to measure the relative
darkness of each ink and drop size, and then use that to build a
dither lookup table.  The tricky part will be adjusting the darkness
values for ink density/bleed - for example, if 100% pure black bleeds
through the paper, you may find doing an 80% dot pattern is sufficient
to achieve the same darkness without bleed-through.  In that case,
you'd multiply the darkness of pure black by 1.25 (100/80 == 1.25)
so that an input grayscale of 100% black would only ever use a
maximum of 80% of pure black ink.

The CUPS DDK contains suitable dither code; currently it is optimized
for dithering 8-bit color data with an internal resolution of 12-bits
(to track fractional errors).  It could be easily adapted to 16-bit

As you dither each input pixel you'll end up with a specific ink and
dot size to use, which can then be added to the corresponding color
channel band (most PCL3GUI modes send color channels in 1-bit rows,
even for 2-bit-per-color inks).  Again, the CUPS DDK's PCL driver
shows how to do this... :)

Michael R Sweet                        Senior Printing System Engineer

More information about the cups-devel mailing list